Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / September 2004

Tip: Looking for answers? Try searching our database.

RANT: HttpWebRequest.GetRequest throws exception when server returns status code of 500.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Hasani \(remove nospam from address\) - 30 Sep 2004 19:40 GMT
Does anyone else agree with me that the WebRequest object SHOULD NOT throw
an exception when the web server returns a status code of 500? I mean, 500
is a valid response and should be expected by the caller. The
HttpWebResponse object already has a StatusProperty, why can it return a
ResponseObject with the status property of 500
(System.Net.HttpStatusCode.InternalServerError). I enjoy working with the
.net framework, and I think highly of everyone involed in its creation and
ongoing progress but I find this to be a blatanly horrible design choice.
Robert Jordan - 30 Sep 2004 19:52 GMT
Hasani (remove nospam from address) wrote:

> Does anyone else agree with me that the WebRequest object SHOULD NOT throw
> an exception when the web server returns a status code of 500? I mean, 500
[quoted text clipped - 4 lines]
> .net framework, and I think highly of everyone involed in its creation and
> ongoing progress but I find this to be a blatanly horrible design choice.

I don't agree. HttpWebRequest throws excections for all status codes
but 200 and 3xx. This is documented. You can still obtain the
Response object from the WebException.Response property.

Checking for error codes is out.

bye
Rob
Hasani \(remove nospam from address\) - 30 Sep 2004 20:16 GMT
> I don't agree. HttpWebRequest throws excections for all status codes
> but 200 and 3xx. This is documented. You can still obtain the
> Response object from the WebException.Response property.

I can't find documentation that explicitly states that it throws on 200 and
3xx, but you are right about the properties of the WebException and this
will be good enough for my needs. Thx for helping me out.

> Hasani (remove nospam from address) wrote:
>
[quoted text clipped - 16 lines]
> bye
> Rob
Robert Jordan - 30 Sep 2004 20:28 GMT
Hasani (remove nospam from address) wrote:

>>I don't agree. HttpWebRequest throws excections for all status codes
>>but 200 and 3xx. This is documented. You can still obtain the
[quoted text clipped - 3 lines]
> 3xx, but you are right about the properties of the WebException and this
> will be good enough for my needs. Thx for helping me out.

From "about HttpWebRequest"

"The HttpWebRequest class throws a WebException when errors occur while
accessing an Internet resource. The WebException.Status property is one
of the WebExceptionStatus values that indicates the source of the error.
When WebException.Status is WebExceptionStatus.ProtocolError, the
Response property contains the HttpWebResponse received from the
Internet resource."

bye
Rob
Hasani \(remove nospam from address\) - 30 Sep 2004 20:18 GMT
I also want to take back 'I find blatanly horrible design choice' statement.
=]
> Hasani (remove nospam from address) wrote:
>
[quoted text clipped - 16 lines]
> bye
> Rob

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.