Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

Posted on 2011-03-21
4
1,689 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
ID: 35183569
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
ID: 35232077
because of link is not much help, as i expected.
0
 

Expert Comment

by:spotprog
ID: 35908968
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
ID: 35912767
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
teach gmail not send email to junk 12 70
cheap and best smart phone 30 115
moto 4g plus silence 65 119
Best bluetooth visor clips 1 26
This article shows how to setup the internet connectivity on Windows Mobile Emulator.   I assume that you already have Microsoft Visual Studio, Microsoft Windows Mobile SDK's and the emulator installed. The emulator is available with Visual Studi…
I recently asked a question (http://www.experts-exchange.com/Programming/Smartphones/Android/Q_28684946.html) about Computer Inventory applications for Mobile Devices.  I was specifically interested in an app I could use on my android phone.  The be…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

808 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