I am trying to get content of http://validator.w3.org/mobile/check?docAddr=www.facebook.com in C#. This is my code:
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
request.UserAgent = "A .NET Web Crawler";
WebResponse response = request.GetResponse();
Stream stream = response.GetResponseStream();
StreamReader reader = new StreamReader(stream);
htmlText = reader.ReadToEnd();
The code works correctly with other pages, but with http://validator.w3.org/mobile/check?docAddr=www.facebook.com and a different docAddr
it's giving me a 500 error. I check with Fiddler and the error is:
HTTP/1.1 500 Internal Server Error
Date: Fri, 03 Jun 2011 22:18:36 GMT
Server: Jigsaw/2.2.6
Content开发者_开发知识库-Length: 59
Content-Type: text/html
Via: 1.1 validator.w3.org
Vary: Accept-Encoding
Connection: close
Servlet has thrown exception:java.lang.NullPointerException
How do I fix this problem?
精彩评论