alfadhel
asked on
Copying file from windows mobile 6.1 to desktop computer using c#.net
I am using this C#.Net code to copy file on network from my PDA to Desktop computer
System.IO.File.Copy(@"\abc .txt", @"\\servername\abc\temp.tx t", true);
every thing is going on fine, but every time i am copying a pop up appears asking user,password,domain name and then copying is successful..
my question is can i implicitly pass user-name,password and domain name from code so that pop up should not appear every time..
any code snippets is appreciable thanks...
System.IO.File.Copy(@"\abc
every thing is going on fine, but every time i am copying a pop up appears asking user,password,domain name and then copying is successful..
my question is can i implicitly pass user-name,password and domain name from code so that pop up should not appear every time..
any code snippets is appreciable thanks...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I can't believe I paid $12.95 for a link a link to another website, and all it said there was stuff I already new!!
Hello There
I dont understand your comments.
To avoid for username and password query when using a network connection you have to use wnetAddConnection3 interface. From pinvoke.net:
private const int RESOURCETYPE_ANY = 0x0;
private const int CONNECT_INTERACTIVE = 0x8;
private const int CONNECT_PROMPT = 0x10;
...
NETRESOURCE ConnInf = new NETRESOURCE();
ConnInf.dwType = RESOURCETYPE_ANY;
ConnInf.RemoteName = @"\\MachineName";
// Allow the user to log onto machine
WNetAddConnection3(hWnd, ref ConnInf, null, null,
CONNECT_INTERACTIVE | CONNECT_PROMPT);
replace the two null args with strings of user name and password.
Instead of the flags "CONNECT_INTERACTIVE | CONNECT_PROMPT" you can use CONNECT_UPDATE_PROFILE to avoid the connect dialog.
regards
Josef
I dont understand your comments.
To avoid for username and password query when using a network connection you have to use wnetAddConnection3 interface. From pinvoke.net:
private const int RESOURCETYPE_ANY = 0x0;
private const int CONNECT_INTERACTIVE = 0x8;
private const int CONNECT_PROMPT = 0x10;
...
NETRESOURCE ConnInf = new NETRESOURCE();
ConnInf.dwType = RESOURCETYPE_ANY;
ConnInf.RemoteName = @"\\MachineName";
// Allow the user to log onto machine
WNetAddConnection3(hWnd, ref ConnInf, null, null,
CONNECT_INTERACTIVE | CONNECT_PROMPT);
replace the two null args with strings of user name and password.
Instead of the flags "CONNECT_INTERACTIVE | CONNECT_PROMPT" you can use CONNECT_UPDATE_PROFILE to avoid the connect dialog.
regards
Josef
ASKER