Click to See Complete Forum and Search --> : webexception


aie
May 29th, 2006, 02:03 AM
In my project I have to make a request to some service and process the response. Now I have the working code in Java


URL url = new URL(link);
InputStream in = url.openStream();
Reader r = new InputStreamReader(in);
...


And I wrote in C# like this

[c#]
WebRequest myWebRequest = WebRequest.Create(link);
WebResponse myWebResponse = myWebRequest.GetResponse();
StreamReader sr = new StreamReader(myWebResponse.GetResponseStream();
[/c#]


The java code works fine but c# throws {"The remote server returned an error: (500) Internal Server Error."} at 3rd line FOR THE SAME LINK!!!
What can be a problem?

aie
May 29th, 2006, 02:21 AM
In MSDN it says to look in Response property of WebException if the Status property is ProtocolError( it is).
What should I be looking for in Response property that might help?