KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I've hunted around for some definitive documentation on this but haven't had much luck finding any. For which HTTP Response Status codes will HttpWebRequest.GetResponse() generate a WebException after doing something like a POST? Specifically, will it generate a WebException for anything other than status 200 OK ? Or will it only generate a WebException for say, 400, 404, and 500 (for the sake of argument)? I want to know since the server I'm communicating with defines anything other than HTTP 200 OK coming back as an error condition. Can I rely on a WebException being generated for anything other than 200? I've currently written my code to check the return status code every time and ensure it's 200 OK . If it's not, it will take appropriate action—but there's a lot of duplication between that code and the catch block for a WebException that I'm hoping to clean up. Any relevant links to documentation would be most appreciated.
Tags (comma-separated)
Save Edits
Cancel