what is the reason for getting 500 (Internal Server Error) RRS feed

  • Question

  • Hi, everyone,


    in order to access a website, I wrote the following code in C#:


                    HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(linkUrl);
                    HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse();

    unfortunately, running the code gets an IIS error: 500 (Internal Server Error).


    I search the web for the reason and most answers say it is the fault of Server.


    However, when I access the website using IE directly, the page can be opened.


    can anyone tell the reason? Thanks in advance.



    Friday, April 6, 2007 8:16 AM

All replies

  • Hi,

    500 says that its Internal Server Error. It doesnt mean that its SERVER error only but it should meant that "server is not able to process the request as expected"


    Let me give you an example,

    If you are creating a request and writing some data on the request to be read on server side (as for example), if this data is in pure HTML form (means contains pure html tags with < and > characters) it will give you 500. Because < and > cant be accepted by IIS Server. while the same data can be successfully sent to the server if you just replace < with &lt; and > with &gt;


    This is just a real example.


    Same way there might be something which doesnt allow on server side when you request that link.


    Another question, when you open in IE, are you giving any credentials?



    Friday, April 6, 2007 7:15 PM