Request.GetResponse() - The remote server returned an error: (500) Internal Server error

  • Thread starter Thread starter Desi Gunda
  • Start date Start date
D

Desi Gunda

Guest
Hi-

I am trying to work with HTTP Request and Response to get the data from the URL and use that data as part of an email that we send out. The code that I have is pretty simple and works like a charm locally. Heres what I have:

WebRequest request = WebRequest.Create(url);

//The line below throws the 500 remote server error
WebResponse response = request.GetResponse();

Stream responseStream = response.GetResponseStream();
Encoding encode = System.Text.Encoding.GetEncoding("utf-8");

StreamReader reader = new StreamReader(responseStream, encode);
string html = reader.ReadToEnd();

reader.Close();
responseStream.Close();
response.Close();

return html;

I have gone through most of the responses where users have used different ways (i.e. w/o using HTTP Request/Response) in the code to solve this issue but I still kept getting this error. So this makes me think that there might some setting in my IIS Manager that I might be missing or wrongly selected on my server. Is there any way someone can give me a checklist/list as in what properties I should be looking into in my IIS settings?

Please advice!

Thanks

Continue reading...
 
Back
Top