It works fine to browse this page : http://www.litteraturmagazinet.se/arga-bibliotekstanten/boklogg/favorit-i-repris-9560835 in a regular browser(for example Chrome).
But when I use the following code to fetch the website I get Internal Server Error (500)?
This is the code I use (and it works great on all other webpages I have tried) :
HttpWebRequest request;
WebResponse webresponse;
request = (HttpWebRequest)HttpWebRequest.Create(url);
webresponse = (HttpWebResponse)request.GetResponse();
The exception is thrown in GetResponse.
I have found for example this : HttpWebRequest.GetResponse() returns error 500 Internal Server Error, but I do not understand it? Why does not request.GetResponse work with this specific webpage? And How do I know what to put in the header(It would be great if it dident hade to be updated later on to diffrent versions)?
Best Answer
I tried your url with wfetch with no headers and i get a 500 as well.
you have to set a proper user-agent in the headers of your request.