Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Network Drive

Status
Not open for further replies.

swade61970

Programmer
Apr 2, 2003
19
US
I am trying to copy a file from one server to another server without using drive letters inside a VB.Net program. If I have both servers mapped in Windows Explorer to a drive letter, UNC naming in my VB.Net works great. If I remove the drive letters and reboot and then try to run the VB.Net program, it fails saying username or password invalid.

I'm guessing it worked with UNC naming before b/c I already established connections to these servers. And since my default username and password for our network is not the same username and password I'm using to connect to the two servers, the VB.net program can connect using my credentials and it can't prompt to ask my username and password.

Any suggestions with this issue? The only workaround I know is that whoever is running this program needs to have a username and password setup the same on the network and the two servers that are being used.
 
You can make a login form where the user will enter his username and password. Then write this:
Process.Start("net use \\ServerName password /USER:username")
this will map the access to the server with no drive letter. Replace the words password and username with the user input.
You can use the ProcessStartInfo instead to customize the action like hiding the prompt window.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top