How to stop the connection from loading a million times, in my http post request with xml data c#



How to stop the connection from loading a million times, so it can read my post request and receive the xml data and select the data I need quickly in my c# program


So I have a HTTP post request going to the server then the server is responding back in sending me data about user like userID in xml format. Then I read in the information via this code.. But it takes a while to read in from the response. And according to fiddler I can see that it keeps sending a post request to the php ( alot). How do I stop this so my program can post once and select the data so the data can be received quickly. Thanks.



//read response
var xml = new StreamReader(response.GetResponseStream()).ReadToEnd();
response.close();


// XML TYPES
XmlDocument xml2 = new XmlDocument();
xml2.LoadXml(xml);
// select data
XmlNodeList info = xml2.SelectNodes("/UserInfo/");
foreach (XmlNode u in info)
{


string id = u["id"].InnerText;
string username = u["username"].InnerText;
string money = u["money_owed"].InnerText;
UID.Text = id;
username.Text = username;
OWED.Text = money;

}

No comments:

Post a Comment