Solved

Copying file from windows mobile 6.1 to desktop computer using c#.net

Posted on 2011-03-21
4
1,646 Views
Last Modified: 2013-12-27
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.txt", 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...
0
Comment
Question by:alfadhel
  • 2
4 Comments
 
LVL 16

Accepted Solution

by:
hjgode earned 500 total points
Comment Utility
You may first authenticate with the server and then use the remote resource. I only know C++ calls so far for WNet API: for example look here http://etutorials.org/Programming/Pocket+pc+network+programming/Chapter+4.+Network+Redirector/Mapping+Network+Resources/

0
 

Author Closing Comment

by:alfadhel
Comment Utility
because of link is not much help, as i expected.
0
 

Expert Comment

by:spotprog
Comment Utility
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!!
0
 
LVL 16

Expert Comment

by:hjgode
Comment Utility
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
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

I think the most popular question in our Windows Mobile Programming zone is about the backlight - we all want to keep it on when our application is running. Few years ago the function SystemIdleTimerReset() did this job. On our side we had to detec…
You should read OS supplied guidelines before developing. I can't stress that enough. The guidelines will help you understand the reasons mobile app developers do what they do.  Apple is very particular when they review appstore submissions.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now