Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I have a program that basically copies files from a unc path (//myotherserver/path/file.txt) to the local machine (d:\destpath\file.txt)

 

it uses system.io.file.copy

 

however, it says the remote path does not exist - this is because you need a username and password to connect to it

 

is there any way i can specify this username/password within my program code?

 

thanks

Posted
I have a program that basically copies files from a unc path (//myotherserver/path/file.txt) to the local machine (d:\destpath\file.txt)

 

it uses system.io.file.copy

 

however, it says the remote path does not exist - this is because you need a username and password to connect to it

 

is there any way i can specify this username/password within my program code?

 

thanks

 

Are you sure the DestPath exist? if not you need to create it first ... to do this:

if(!Directory.Exist("D:\\destpath"))
{
   Directory.Create("D:\\destpath"));
}
File.Copy(strPath,strdest);

Posted
Are you sure the DestPath exist? if not you need to create it first ... to do this:

if(!Directory.Exist("D:\\destpath"))
{
   Directory.Create("D:\\destpath"));
}
File.Copy(strPath,strdest);

 

yes - it definitely exists - it just needs the username/password - thats what i need to know - how can you code it to specify the username/password?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...