Fog Creek Software
Discussion Board




Welcome! and rules

Joel on Software

Problem w/HttpWebResponse

I am trying to access a web page with code like:

HttpWebResponse webResponse = (HttpWebResponse) webRequest.GetResponse();

And I get a System.Net.WebException: The remote server returned an error: (500) Internal Server Error.

When I try the same thing using LWP::Simple in Perl, I print the returned HTML and see:

302 Moved Temporarily <URL: ...>

And pasting the URL into the browser address works fine, as the browser correctly follows the temporary redirect.

Any suggestions on how to get the HttpWebResponse not to choke on this?

steved
Thursday, July 17, 2003

Set up ProxyTrace and get IE to use it as its proxy http://www.pocketsoap.com/tcptrace/pt.aspx

Browse to the offending site. In the trace you will see exactly what's going on.

It could possibly be something about the way the site in question deals with cookies. HttpWebResponse doesn't automatically ping cookies back to the server and the server-side script could be assuming that the cookies will be there and falling over.

Duncan Smart
Thursday, July 17, 2003

*  Recent Topics

*  Fog Creek Home