|
Thank you very much. I have just tested it with Outlook2003 and it works fine. The problem is in Outlook 2007.
|
|
|
|
|
Public AsynCallback pfnWorkerCallBack; //Define a global reference
public void WaitForData(System.Net.Sockets.Socket soc,int clientNumber)
{
try
{
if( pfnWorkerCallBack == null )
{pfnWorkerCallBack = new AsyncCallback (OnDataReceived);}
SocketPacket theSocPkt = new SocketPacket (soc, clientNumber);
soc.BeginReceive (theSocPkt.dataBuffer, 0,
theSocPkt.dataBuffer.Length,SocketFlags.None,pfnWorkerCallBack,
theSocPkt);
}
}
public void main()
{
WaitForData(Socket1,1);
WaitForData(Socket2,2);
}
Question:
1.When the 1st WaitForData(Socket1,1) started, pfnWorkerCallBack is definitely equal to NULL so a new AsynCallback is created and assigned to pfnWorkerCallBack. What happen to pfnWorkerCallBack when the second WaitForData(Socket2,2) started?
2.When a same method was started asynchronously for several times. Are all method's variables refer to the same variables?
|
|
|
|
|
I have created a shared folder through Windows e.g. 'D:\Testing'
I have given permissions to 3 users A, B, C
Now, I want to access the names of these three users.
I am using GetSecurityDescriptor for performing this but,
the DACL returned by this function always contains 7 users
(out of 6 are default and 1 loggedin user) irrespective of shared permissions.
DDeepali
|
|
|
|
|
This is because there are two levels of permissions in play when you share a folder:
1. The permissions on the *folder* in the file system (NTFS). Accessible via the "Security" tab in the properties dialog box for the folder. These permissions are in effect even when you access the folder locally (not only via networking). The permissions are stored in the file system, and are what you get when you query the file system (NTFS).
2. The permissions on the *share* (accessible via the "Permissions" button on the "Sharing" tab). These apply only when accessing the share via the file server component (lanmanserver - which started its life as a port of OS/2 LAN Manager, hence the name) in the system. These permissions (along with the share name and other settings) are stored in the registry (HKLM, System, CurrentControlSet, Services, lanmanserver, Shares).
In order to access a file via a file share, you need the appropriate permissions on BOTH.
Most likely you are querying the file system, so you get the file system permissions. I suspect you have to use another API (or framework namespace) to find the share permissions (never done it myself).
Before Windows Server 2003 best practice (and default) was to grant everyone full control to the share and then control permissions in the file system. Most people still do that (as those permissions will be enforced even if users use other protocols/services to get at the files). The default configuration in WS2003 is to only grant everyone read-only access to new shares, though.
Confusing? Yes, but that's unavoidable. The file server has to be able to secure stuff residing on insecure file systems (such as FAT), and therefore needs an additional layer of security. When you use NTFS, however, there's not much point in using that layer - and as noted, most people tend to use "everyone, full control" at share level and then control access with the NTFS permissions.
HTH
--
Peter
|
|
|
|
|
Thanks alot for such a knowledgeable reply.
I will try to some APIs that can help me.
thanks alot
DDeepali
|
|
|
|
|
Thanks for the appreciation!
On a second note - my experience (20+ years of working with sysadmin tasks in various OSes) is that permissions should never be granted to users or organizational groups (groups that are based on peoples role's). The one way of achieving zero maintenance for folder/share permissions is:
1. Create a group (machine or domain local depending on scope of the resource) for the resource. Name it so that the resource and appropriate access is described, such as "Product presentations (modify)". Only create groups for permissions that are actually needed - otherwise, you'll end up swamped with unnecessary groups...
2. Grant the appropriate NTFS permissions to that group (as well as full control to SYSTEM and Administrators). Grant file share permissions accordingly (except for SYSTEM - not applicable at share level).
3. From then on - manage permissions by adding/removing users and/or user role groups to/from the resource group.
Not only will you never need to fiddle with file system and/or share permissions once they have been created, but you will also be able to delegate (assuming you use domain local groups) permissions management to someone who doesn't have access to the file system/share permissions. Also, it is somewhat simpler to script/automate group membership management than permissions management. You'll also never more need to see "account unknown" in an ACL after users have been deleted (if you use machine local groups and add domain users to them, you will see them in the group memberships instead - but not if you stick to domain groups).
Later,
--
Peter
|
|
|
|
|
<br />
namespace WindowsFormsApplication1<br />
{<br />
public partial class Form1 : Form<br />
{<br />
private List<Data> dataList = new List<Data>();<br />
public Form1()<br />
{<br />
InitializeComponent();<br />
dataGridView1.DataSource = dataList;<br />
}<br />
<br />
private void addTToolStripMenuItem_Click(object sender, EventArgs e)<br />
{<br />
dataList.Add(new Data() { Name = "V", LastName = "J" });<br />
dataGridView1.DataSource = null;<br />
dataGridView1.DataSource = dataList; <br />
}<br />
<br />
private void FillData()<br />
{<br />
dataList.Add(new Data() { Name = "V", LastName = "J" });<br />
dataList.Add(new Data() { Name = "A", LastName = "B" });<br />
dataList.Add(new Data() { Name = "C", LastName = "D" });<br />
}<br />
}<br />
<br />
public class Data<br />
{<br />
public string Name { get; set; }<br />
public string LastName { get; set; }<br />
}<br />
}<br />
In the above code I try to add a data in the List through gridview by using context menu.
Its working fine if already List is populated by data.
But fails if I try to add a data without the List is populated.
Scenario on fail:
screen 1: Form with empty gridview is shown.
screen 2: I right click the gridview which show the context menu "Add", when I clicks addTToolStripMenuItem_Click method is called. which creates the data and adds in the list.
screen 3: The gridview with the one data is appearing.
scrren 4: When I tried to click on the cell ( i.e, newly created ). The error is getting thrown "IndexOutOfRange" -1.
Is I am missing any propeties to set.
Thanks in advance
Regards,
Vythees
Miles to go before sleep...
|
|
|
|
|
vytheese wrote: dataList.Add(new Data() { Name = "V", LastName = "J" });
dataGridView1.DataSource = null;
Hi, I haven't used this, but it seems to me the order of the above lines is wrong;
I would remove the bind, modify, then reinstate the bind.
|
|
|
|
|
Like this,
dataGridView1.DataSource = null;
dataList.Add(new Data() { Name = "V", LastName = "J" });
dataGridView1.DataSource = dataList;
I tried that too, Not working..
Regards,
Vythees
Miles to go before sleep...
|
|
|
|
|
Hi,
I have a few forms in my C# windows application. On main form, by a button, another form is shown. On this second form, by a button, another form is shown MODALLY ( ShowDialog() ). In such stiuation, when another application (ex: windows explorer) becomes activated, then my application reactivated using application-icons on windows Task Bar, my Main form appears on top and does not respond to user because another form is shown modally which actually does not appear.
In fact, here, when windwos' Alt-Tab browsing is used, it seems no problem.
How can I ensure the last opened form to bring to front in such cases?
I know it seems a small problem but really bothering..
Thanks for you help
|
|
|
|
|
You can test the following code snippets:
<br />
<br />
private void mnuAbout_Click(object sender, System.EventArgs e)<br />
{<br />
Form f = new Form();<br />
f.ShowDialog(this);<br />
}<br />
<br />
Anindya Chatterjee
|
|
|
|
|
Yes, setting the owner of a dependent form should do it.
|
|
|
|
|
Hi all,
I have a dataset and already bind to one datagridview. I am using DataGridViewRowsRemovedEventHandler to remove row (click on selected row and press delete). After i removed the row, and using loop to display the data in dataset. I get the exception above and the details as below :
This row has been removed from a table and does not have any data. BeginEdit() will allow creation of new data in this row.
How can i remove the row completely in dataset to avoid this error?
any tips are welcome.
regards
cocoonwls
|
|
|
|
|
I am developing a C# app which will download Rapidshare files for Free users. The program would work as follows:
1. Rapidshare webpage would open in WebBrowser control.
2. Captcha would be input in the webpage
3. File download will occur using the download manager of the app, instead of the default download manager.
I have designed the download section in the following way.
<br />
private void rapidWebBrowser_Navigating(object sender, WebBrowserNavigatingEventArgs e)<br />
<br />
{<br />
<br />
string filename = @"C:\test.rar";<br />
<br />
Regex pattern = new Regex(@"http://([0-9a-zA-Z]+)\.rapidshare\.(com|de)/files/([0-9]+)/([0-9]+)/([^\r\n]+)", RegexOptions.IgnoreCase);<br />
<br />
string match = e.Url.AbsoluteUri;<br />
<br />
if (pattern.IsMatch(match))<br />
<br />
{<br />
<br />
e.Cancel = true;<br />
<br />
WebClient client = new WebClient();<br />
<br />
Uri uri = new Uri(match);<br />
<br />
client.DownloadFileAsync(uri, filename);<br />
<br />
}<br />
<br />
}<br />
<br />
While running, the app downloads a 10KB file instead of the real one. If I use the followsing code:
<br />
private void rapidWebBrowser_FileDownload(object sender, EventArgs e)<br />
<br />
{<br />
<br />
Regex pattern = new Regex(@"http://([0-9a-zA-Z]+)\.rapidshare\.(com|de)/files/([0-9]+)/([0-9]+)/([^\r\n]+)", RegexOptions.IgnoreCase);<br />
<br />
if (pattern.IsMatch(match))
<br />
{ <br />
<br />
WebClient client = new WebClient();<br />
<br />
Uri uri = new Uri(match);<br />
<br />
client.DownloadFileAsync(uri, filename);<br />
<br />
}<br />
<br />
}<br />
<br />
the app downloads a 10KB file and pops up IE's default download manager.
How to solve the problem? I want to intercept the original file download by WebBrowser control, and pass the url to my app's custom downloader suppressing the IE's downloader. How to do this?
I am eagerly waiting for the solution. Thank you in advance.
Anindya Chatterjee
|
|
|
|
|
Have you tried renaming the small file you get and opening it in IE? I believe Rapidshare blocks download accelerators.
Cheers,
Vikram.
The hands that help are holier than the lips that pray.
|
|
|
|
|
I am not at all using any accelerator. I am just using mere WebClient to download. Basically I know that using Http POST Rapidshare transfer files. But how to embed it in my app to intercept the default download manager, I don't know. That is I am searching for.
Anindya Chatterjee
|
|
|
|
|
Apologies, I misread your post. I had tried using a download accelerator once and it failed.
Have you tried downloading the full file and comparing its contents with those of the one your app downloads? I still think it might be useful to rename the file you get to .HTML and open it in your browser.
Cheers,
Vikram.
The hands that help are holier than the lips that pray.
|
|
|
|
|
Has anyone here ever experienced this error message?
The application that gave me this error message works fine on my work computer but throws this exception on my home computer.
|
|
|
|
|
Guess you didn't move a config file, or it points to something that is not present on your home PC
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I zipped up the entire directory containing the solution from my work computer.
The exception stems from a 3rd party dll that resides in the bin/debug directory of the solution.
But like I said, I zipped the solution directory in its entirety and copied it from my work computer and the solution works with no problems on my work computer, although it is failing on my home computer.
I searched Google and there are a lot of results for this error message but I didn't see a clear pattern in regards to what I am working on and I'm not sure where to begin on this one.
|
|
|
|
|
I presume this means the 3rd party DLL is not properly configued/installed. Often on a dev machine, the files go in the GAC and so don't end up in the folder you zip up.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Is that 3rd party DLL a mixed mode DLL? I have seen this error message pop up because the machine did not have the VC side by side DLLs installed. Installing vcredist_x86.exe from C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\vcredist_x86 should fix that.
|
|
|
|
|
Isn't vcredist_x86.exe specific to C++ development?
This project is written in C#.
|
|
|
|
|
OK - Let me give you some additional information for debugging purposes.
I've tried removing the reference to the problem assembly and then readding the reference. This appears to be the only way to follow the exception instruction message to "reinstall the application."
Also, I have tried downloading a new version of the dll as well as using the dll from my work environment.
On my home computer, I just have VS2008 while on my work computer I have both VS2005 as well as VS2008.
Here is a url to the component:
http://tinyurl.com/6nj22s[^]
Once you have added a reference to the dll you should be able to write the following statement:
>AddressBook addressBook = new AddressBook();
This works for me in my work environment but throws an exception in my home environment.
Please let me know what you find.
modified on Monday, May 5, 2008 11:39 PM
|
|
|
|
|
The code runs fine on my machine.
Did you try running the release version on your home PC? I faced a similar problem - a debug mode C++/CLI DLL built on VS 2005 SP1 did not run on a machine with only VS 2005, but the release mode DLL ran fine.
|
|
|
|