tags:

views:

49

answers:

2

I've an application that's uploading data to a server. Occasionally the server returns a 403 response from a call to HttpWebRequest.GetRequestStream(). The response contains more data than simply the response code, but I can't figure out how to access it. Is there a way to do this?

A: 

I think what follows is just the text of the why the server sent back a 403:

http://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html

John at CashCommons
+1  A: 

Have you tried calling HttpWebRequest.GetResponse() yet? The HttpWebResponse class provides access to that information.

Remy Lebeau - TeamB
GetResponse seems to do a similar thing. It throws an Exception and so doesn't return a HttpWebResponse object.
alnorth29
If a WebException is being thrown, then you can use the WebException.Response property to access the response info.
Remy Lebeau - TeamB
Ah, fantastic, hadn't noticed that. Thanks!
alnorth29