Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
4.2k views
in .NET FTP by (460 points)
I have added a "View" option to the context menu for the FTPLocalFileList and it works correctly allowing me to load the file using its file association. I can't seem to find a way to make it work on the FTPRemoteFileList. Using the same logic as on the FTPLocalFileList I keep receiving a "The system cannot find the file specified" error. I assume this is because I'm not specifying the complete path on the remote server and/or because I'm really looking at the local machine instead of the remote machine.

I'm connecting to a web site. The easily obtained path is "/MyWeb.com/MyFile.html". The full path on the web server is "C:/inetpub/wwwroot/MyWeb/MyFile.html" but even if I hard code that path I still get the same error.

I'm using ftpRemoteFileList1_SelectedIndexChanged to obtain the name of the selected file. How can I precede that with the proper path information?

Thanks

3 Answers

0 votes
by (162k points)
To be able to view the remote file, you'll have to first download it from the webserver into a temporary file or into memory and then display it.
0 votes
by (460 points)
Thank you, but I still have the same question. How do I obtain the correct path for downloading the file? I know I could just use your built in download functionality but I don't want to do that since it might over write the version of the file already on the local machine. I need to know the path (just like your functionality does for context menu actions) so that I can save the file with a temporary name, or stream it so that it can be viewed.

Thanks
0 votes
by (162k points)
The ServerDirectory property on the FTP connection instance + the file name should give the path.

Categories

...