473,847 Members | 1,884 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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:\te mp\hi.txt, \\myremote\c$\t emp\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 3902

"POnfri" <PO****@discuss ions.microsoft. com> wrote in message
news:1D******** *************** ***********@mic rosoft.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:\te mp\hi.txt, \\myremote\c$\t emp\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.Enterpr iseServices 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
12355
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 standard streamreader, textreader or file classes I get an access denied error message (which I expect). If I go Start | Run and type this in, I get prompted for network credentials. After supplying the correct credentials I can access the file both...
4
15436
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, as outlined in some samples I found on MSDN and elsewhere, but so far have had no luck whatsoever. The copy process doesn't fail, but neither does the targeted file actually appear on the destination server. I have verified that I can copy...
18
4366
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 get it to upload a file to the FTP server. I just get a "Cannot connect to remote server" error after this TRY: s = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
8
9773
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 problem: my vb.net program has problems with UNC. If the UNC server is restarted or goes off-line, my VB.net program crashes. The code for UNC access to the file is included below and is put in the tick event of a form timer control running every...
1
8144
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 I'm just running it locally and saving the file locally using my machines UNC path. I have given user ASPNET full control over the folder I want to write the file to. I've also tried using the web config identity impersonation to use my user...
24
7413
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 in java swings
5
33222
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 following error. Error 1 Could not load file or assembly 'Microsoft.Practices.ObjectBuilder, Version=1.0.51205.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
4
6923
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 function creates the file as expected. When I loop through my array I get the error - "ArgumentException was unhandled - Illegal characters in path" The value "C:\Temp.txt" is the first value in the array - as it works
2
5490
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 sqlserver 2000 & asp.net 2005 for my project.. I have written one stored procedure which creates one Text file on
0
10643
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10330
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9477
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7879
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7050
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5907
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4521
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4113
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3158
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.