c# - FTPWebRequest: can you see any problem in my code? -


I am creating a Windows application that calls this function. This function reads the XML file which is located on the server. And about 30 customers have installed this app. Maybe they will call this function at the same time.

My question:

Will there be a problem here when many users will call this method at the same time?

  public string GetXmlInnerText () {FtpWebRequest tmpReq = faucet; System.Net.WebResponse tmpRes = Null; Try {if (settings.default.innal) tmpReq = (FtpWebRequest) FtpWebRequest.Create ("ftp: //  

thanks

A problem - you do not settle This code is applied to WebResponse , IDisposable , so you should use the statement using statement with your existing structure, doing it a lot Not easy - you should think properly to regain / catch your efforts.

Next, StreamReader uses UTF-8 by default - if your XML documents are not encoded in UTF-8, then you may have problems. If this is an XML document, why not load it from XmlReader.Create (stream) or something similar? They will handle the encoding for you.


Comments