?
Solved

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

Posted on 2011-03-21
4
Medium Priority
?
1,768 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
[X]
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
  • 2
4 Comments
 
LVL 16

Accepted Solution

by:
hjgode earned 1000 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

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…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses
Course of the Month11 days, 3 hours left to enroll

770 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