By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,262 Members | 1,125 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,262 IT Pros & Developers. It's quick & easy.

File.Copy error: File not found when remote

P: n/a
Hi,

I have a problem in a peace of code were i'm doing a file copy using
File.Copy. The Source is local and the target is a remote machine.

Example: File.Copy(C:\temp\hi.txt, \\myremote\c$\temp\hi.txt, true);

This API is run from a web service that exposes it. The problem is as follows:

1) I request a page (On the web service machine) from my web server (Note
this page asks what file you need for example).
2) When i click on the submit button the file is copied just fine
3) Now i got to another client machine int he same domain and i log in as
the domain admin ect..
4) I request my client page so i can request a file to be copied.
5) I click ont he submit button and i get an error in my log stating that it
could not find the file specified?

The messed up part is that i have sat at the debugger side by side and
walekd the code on both machines ( one attached to the remote machine and one
attached local) and i get the same information thru the code except when i
get to the File.copy statment, the remote blows up with the file not found
error and the other works just fine. Both of them talk to the same web server
and web service so thisi s something i can't even start to figure out.

Thanks for any help!
Nov 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a

"POnfri" <PO****@discussions.microsoft.com> wrote in message
news:1D**********************************@microsof t.com...
Hi,

I have a problem in a peace of code were i'm doing a file copy using
File.Copy. The Source is local and the target is a remote machine.

Example: File.Copy(C:\temp\hi.txt, \\myremote\c$\temp\hi.txt, true);

This API is run from a web service that exposes it. The problem is as
follows:

1) I request a page (On the web service machine) from my web server (Note
this page asks what file you need for example).
2) When i click on the submit button the file is copied just fine
3) Now i got to another client machine int he same domain and i log in as
the domain admin ect..
4) I request my client page so i can request a file to be copied.
5) I click ont he submit button and i get an error in my log stating that
it
could not find the file specified?

The messed up part is that i have sat at the debugger side by side and
walekd the code on both machines ( one attached to the remote machine and
one
attached local) and i get the same information thru the code except when i
get to the File.copy statment, the remote blows up with the file not found
error and the other works just fine. Both of them talk to the same web
server
and web service so thisi s something i can't even start to figure out.

Thanks for any help!


What you have here is a security issue.
When you run the client on the same machine as the web server, the
webservice uses the client's credentials to authenticate with the remote
file server. However, when you run the client on a separate box from the web
server, these credentials are not available on the webserver (though the
client is authenticated) so the webservice can't make an authenticated
second hop to the resource server using the base client's credentials.
One possibility to solve this is to set-up Kerberos delegation
(Check:
http://www.microsoft.com/msj/0899/ke.../kerberos.aspx and
http://www.microsoft.com/technet/pro.../kerberos.mspx)
for details.)

Note that this requires a W2K Kerberos realm (Active Directory Domain) to
run.
When you run the Webservice on W2K3 you can take advantage of the Kerberos
extension (Check this article:
http://www.microsoft.com/technet/pro...constdel.mspx).
so you are free to use any protocol available to authenticate the base
client (Basic, SSL, ...) other than Kerberos.

Another option (preferable) is to run the "remote file server access code"
in a server type COM+ application (System.EnterpriseServices namespace)
running with fixed identity having access to both local and remote
resources.

Willy.


Nov 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.