Remote Copy using C# in ASp.net

G

Guest

Hi
I have an ASp.net application using C#. I need to copy a file present on the web server machine to a remote machine on the network. Although this seems to be a trivial matter I am having difficulties copying the exe

I am Trying

string Source = @"c:\temp\test.exe"
string Destination = @"Z:\test.exe"

File.Copy(Source, Destination, true)

Z: is mapped to the Remote machine network drive. I am able to physically copy files to this drive from the Web Server machine, but when I try from ASp.net, I get the following erro

System.Io.Exception: Logon Failure: unknown user name or bad passwor

I think it has to do with the Web Server using the ASPNET user , which does not have the right credentials on the remote machine. I do not know how to solve this issue

I tried using WMI too, I was able to copy files from one directory to another directory on the remote machine, but not from the Web Server machine to Remote machine

Any help in this matter is appreciated

Regards
PR
 
J

Jared Parsons [MSFT]

You need to grant the AspNet member on the web server access rights to the
directory you're trying to copy to. Right clikc on the driver in "My
Computer" and choose Properties->Security. Add the appropriate permissions
there.



--
Jared Parson [MSFT]
(e-mail address removed)

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

PRM said:
Hi,
I have an ASp.net application using C#. I need to copy a file present
on the web server machine to a remote machine on the network. Although this
seems to be a trivial matter I am having difficulties copying the exe.
I am Trying

string Source = @"c:\temp\test.exe";
string Destination = @"Z:\test.exe";

File.Copy(Source, Destination, true);

Z: is mapped to the Remote machine network drive. I am able to
physically copy files to this drive from the Web Server machine, but when I
try from ASp.net, I get the following error
System.Io.Exception: Logon Failure: unknown user name or bad password

I think it has to do with the Web Server using the ASPNET user , which
does not have the right credentials on the remote machine. I do not know
how to solve this issue.
I tried using WMI too, I was able to copy files from one directory to
another directory on the remote machine, but not from the Web Server machine
to Remote machine.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top