Remote FileCopy using 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
 
P

Pete Wright

You're absolutely right. ASPNET is a local account, and the local ASPNET
account on one machine has very different credentials to the ASPNET account
on the other machine.

I'm not a sysadmin so I don't know whether granting rights on machine B to
\\A\ASPNET would help or not, but from a programmatic point of view other
options you could look into would be FTP, and of course Web Services.

--
--------------------------------------------------------
Peter Wright (www.petewright.org)
Author of ADO.NET Novice To Pro
From Apress. www.apress.com (and 10
other doorstops from Wrox)


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