views:

320

answers:

0

I have a method which creates HttpWebRequest for a given url and returns XmlReader object with the response stream.

HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(url); 
req.Accept = "*/*";
req.Headers.Add("UA-CPU", "x86");                
req.UserAgent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; MS-RTC LM 8)";
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
return XmlReader.Create(resp.GetResponseStream());

The XmlReader is valid XML when called from regular code behind function call. It is {None} if called from a web service which in turn is called from a client script.

When I compare the xml output from these 2 calls using a StreamReader, I see this:

Regular code behind call - <?xml version="1.0" encoding="utf-8" ?>
Client Script Web service call - <?xml version=\"1.0\" encoding=\"utf-8\"?>

XmlReader is unable to comprehend \"utf-8\" or =\"1.0\" and hence returns {None}?

I need the XmlReader (with valid XML) to do my XSL tranformations. Any ideas?