Skip to main content
Home Forums Silverlight Programming Programming with .NET - General HttpWebResponse.GetResponseStream() is null-http status code 500
2 replies. Latest Post by vb7484 on June 28, 2008.
(0)
XASD
Member
91 points
55 Posts
06-19-2008 12:41 AM |
When HttpWebResponse.StatusCode!=HttpStatusCode.OK then GetResponseStream() is null, but how I can get response in case of http status code is 500 or something like that? Server trying to say something to me,but I can't read.
Thanks.
Yi-Lun L...
All-Star
25052 points
2,747 Posts
06-23-2008 4:46 AM |
Unfortunately due to browser stack limitation, currently there's no way to get the actual http status code... If you have the control over the server, you can customize the response, so if something wrong happens, it still returns 200, but with a message indicating something wrong happened...
vb7484
2 points
1 Posts
06-28-2008 5:55 AM |
You need to catch the WebException that is thrown by HttpWebRequest.GetResponse. This exception includes useful info about Status, and the actual WebResponse that you're after. Just read the MSDN page: http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.aspx