Get my application to be allowed access through firewall using c#

前端 未结 4 1837
失恋的感觉
失恋的感觉 2021-01-24 09:10

i am trying to get my application to be allowed through firewall, as I have to do ftp in active and passive mode is not an option as servers are not configured for that. so i tr

4条回答
  •  悲哀的现实
    2021-01-24 09:33

    i have observed that if i change the order of ftp download statements to following windows dialog appears asking that do you want to allow this program access through firewall; if i click allow access the code works perfectly.

    requestDownload = (FtpWebRequest)WebRequest.Create(uri);
                                requestDownload.UsePassive = false;
                                requestDownload.KeepAlive = false;
                                requestDownload.UseBinary = true;
                                requestDownload.Method = WebRequestMethods.Ftp.DownloadFile;
    
    
                                requestDownload.Credentials = new NetworkCredential(ftpInfoDownload[3], ftpInfoDownload[4]);
    
                                responseDownload = (FtpWebResponse)requestDownload.GetResponse();
                                Stream ftpStream = responseDownload.GetResponseStream();
    

提交回复
热议问题