« Previous Next »

Thread: FileUpload problem on a FTP server

Last post 11-09-2008 12:34 PM by Gabriel_EUK. 3 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (4 items)

Sort Posts:

  • 11-07-2008, 6:37 AM

    FileUpload problem on a FTP server

    I created a ASP.Net application in which I am uploading a file on a FTP SERVER.

    Its works fine when I am running it from CASINI server (ASP.Net Server). But when hosted in IIS it is giving following error:

    The remote name could not be resolved: 'ftp.ServerName'   at System.Net.FtpWebRequest.GetRequestStream()
    webEx.Response - > System.Net.FtpWebResponse
    webEx.Status - > NameResolutionFailure
    webEx.Message - > The remote name could not be resolved: 'ftp.ServerName'

     

    On changing the server name with its IP address, following error comes:

    Unable to connect to the remote server   at System.Net.FtpWebRequest.GetRequestStream()
    webEx.Response - > System.Net.FtpWebResponse  
    webEx.Status - > ConnectFailure  
    webEx.Message - > Unable to connect to the remote server


    Note: We are already using the Microsoft Firewall Client for ISA Server.

    Code Snippet:

    Uri serverUri = new Uri(ftpPath + ftpFileName);

    FtpWebRequest request = (FtpWebRequest)WebRequest.Create(serverUri);
    request.Method = WebRequestMethods.Ftp.UploadFile;
    request.Proxy = null;

     

    FileStream stream = File.OpenRead(fileName);
    byte[] buffer = new byte[stream.Length];
    stream.Read(buffer, 0, buffer.Length);
    stream.Close();

     

    Stream reqStream = request.GetRequestStream();
    reqStream.Write(buffer, 0, buffer.Length);
    reqStream.Close();

    P.S: I am reposting it here... earlier i posted it under following category..
    Home › Forums › IIS 5.x & 6.0 › ASP.NET Administration › FileUpload problem on a FTP server

  • 11-07-2008, 8:12 AM In reply to

    Re: FileUpload problem on a FTP server

     Are you able to FTP to the server manually? I mean without using your script... Tried using the FQDN??

    Regards,
    MA Khan
    http://www.iisworkstation.com

    “Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. ”
  • 11-07-2008, 8:41 AM In reply to

    Re: FileUpload problem on a FTP server

    Yes, I am able to upload file successfuly via console application or ASP.Net web application.

    New point that i came to know that ... same code is working fine on (Win XP + IIS 5) but not on (Win Server 2003  + IIS 6).

    In (WinXP + II5) followed same steps... create a ASP.Net web app and publish it in IIS... and its working.

     

  • 11-09-2008, 12:34 PM In reply to

    Re: FileUpload problem on a FTP server

    according to the error message "The remote name could not be resolved: 'ftp.ServerName'"   it seems that ftp.ServerName is not resolving to your FTP server IP address. Also you should have IIS5 and IIS6 on different server, as you have ISA on your IIS 6 server make sure you enable FTP ports in it. If its enabled then you should be able to telnet and tracert should be completed successfully, have you checked for telnet and tracert ?

Page 1 of 1 (4 items)
Microsoft Communities