[.net] error: the network path not found

Started by
4 comments, last by TheTroll 15 years, 9 months ago
Hi , I want to upload some files to a remote machine frequently.We have an ftp .But I cannot use FTP for uploading file as ftp is not available from remote server. I planned to write an application for that using FileWebResponse class. As a starting point I just tried to access that machine using program. But I am getting an error like the network path not found. FileWebResponse response=null; try { Uri uri = new Uri("file://remotemachinename/sharedfolder/sample.txt"); if (uri.Scheme == Uri.UriSchemeFile) { FileWebRequest request = (FileWebRequest)FileWebRequest.Create(uri); request.Credentials = new NetworkCredential ("username", "password", "domainname"); response = (FileWebResponse )request.GetResponse(); //ERROR happens here StreamReader reader = new StreamReader(response.GetResponseStream()); string tmp = reader.ReadToEnd(); response.Close(); } } catch(Exception ex) { Console.WriteLine(ex.Message); } finally { if (response != null) { response.Close(); } } Note: Remotemachine is not in my network. I am able to connect the remotemachine using mstsc with a username and password in the domain of remotemachine. I want to read a file in a shared folder in D drive of that machine. Could anybody give me a hint ...? Thanks in advance,
Advertisement

Hi All,
Is there any other way to achieve the same. I mean, uploading files to a remote machine outside my network. I have a user account with admin privilege in the remote machine. Any help ...plz?
Yes it is called ftp. Yes I know ftp is not on the remote machine but if it is going to be receiving files, don't you think it should have ftp. File shares work well on a local network but it is not designed for internet transfers.

theTroll
How big is the file? What type? And can you put your own application on the server?

theTroll
Thank u so much TheTroll for your reply.

files are most of the time dlls and exe.Most of the times they are of size in KBs.

What could be the reason ftp site is not accessibile from a server?
If there is an ftp server on the server then it is most likely the ftp port is not open.

theTtoll

This topic is closed to new replies.

Advertisement