Today one
of our automated tests failed. After looking into this issue, I noticed that in
this test case, we need to verify the http status code of some links.
The
interesting part is that one external link is always working, but
HttpWebRequest.GetResponse() always returned the error code 500.
After
doing some research, I added the code (Yellow) in our utility class. After
running the test again, the test passed.
string
url="https://www.XXX.com/";
HttpWebRequest
myWebRequest = (HttpWebRequest)WebRequest.Create(url);
myWebRequest.UserAgent
= "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
WebResponse
myWebResponse = myWebRequest.GetResponse();