I am getting xml data through an httpwebrequest. The following code was working fine. But something changed and suddenly started to give me an exception on Read() method with error : The '', Hexadecimal value 0x1F, is not a valid character. Line 1, Item 1. In web browser sURL gives me a valid xml. I dont know what changed.
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(sURL);
req.Method = "GET";
WebResponse response = req.GetResponse();
StreamReader resStreamReader = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
XmlTextReader reader = new XmlTextReader(resStreamReader);
while (reader.Read())
{
// some code
}