473,395 Members | 2,468 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

File.Copy error: File not found when remote

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
1 3875

"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Glen Conway | last post by:
Hi, I am trying to get the contents of a file in a hidden share on a remote server, something like '\\server.domain.com\c$\program files\application\document.xml'. When I try any of the...
4
by: Shannon Hardin | last post by:
I'm trying to build a routine that will take a specified file from the user's local hard drive, and copy it to a remote server via WebDAV. I've tried using both HttpWebRequest and FileWebRequest,...
18
by: Jen | last post by:
I'm using Microsoft's own VB.NET FTP Example: http://support.microsoft.com/default.aspx?scid=kb;en-us;832679 I can get the program to create directories, change directories, etc., but I can't...
8
by: Sarah | last post by:
I need to access some data on a server. I can access it directly using UNC (i.e. \\ComputerName\ShareName\Path\FileName) or using a mapped network drive resource (S:\Path\FileName). Here is my...
1
by: Duffman | last post by:
Hi, I have what seems to be a common problem, but the solutions I've found don't seem to work. I would like to use a web service to create a file at a UNC location in a shared file. Currently...
24
by: crazystone82 | last post by:
Hi all, please send me a source code to transfer a file to a server running on another pc in the LAN...using JAVA .By getting the source path and destination path through textfield implemented...
5
by: BSM | last post by:
Hi, I developed one project in my Remote machine. I used Microsoft Enterprise Library. It is working fine in Remote computer. When I open the project and run in my local computer. It shows the...
4
by: Vlad | last post by:
I am having problems using the file.create method within a function that is called when looping through an array of filepaths. If I call my function with a hardcoded file path --C:\Temp.txt the...
2
by: Bhavesh | last post by:
Hi everybody, I have problem in copying file from DatabaseServer to WebServer.Both machines are on LAN. Let me explain in details what i am doing & wht i want to achieve... I am using...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.