[Mono-bugs] [Bug 526069] New: WebClient.DownloadData / HttpWebRequest.CheckFinalStatus generates incorrect WebException on HTTP error status

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Jul 28 13:05:21 EDT 2009


           Summary: WebClient.DownloadData /
                    HttpWebRequest.CheckFinalStatus generates incorrect
                    WebException on HTTP error status
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.0.x
          Platform: PC
        OS/Version: Ubuntu
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: CORLIB
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: t8 at pobox.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---

User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US;
rv: Gecko/20090715 Firefox/3.5.1

mono 2.0.1 (instlled via apt on Ubuntu 9)

Calling WebClient.DownloadData("http://www.google.com/a/b/c") throws as
WebException as expected due to the server returning a 404.

According to the MS docs, the WebException.Status prop should have the value
WebExceptionStatus.ProtocolError (and hence casting WebException.Response to
type HttpWebResponse should provide a valid HttpWebResponse.StatusCode (i.e.

However, instead the WebException.Status is WebExceptionStatus.UnknownError and
it isn't possible to retrieve the HTTP response status (except by parsing it
out from the exception Message, which contains "The remote server returned an
error: (404) Not Found.", or possibly via the response headers directly - which
I've not tried (yet)).

(Please note that I am a Mono *user*, not a Mono developer.  I report this for
your convenience, so please don't ask me to try a newer version of Mono or
recompile or anything like that as I do not have time available for Mono
debugging, sorry.  If further information is required and nobody else has the
resources to provide it, just close the issue).

Reproducible: Always

Steps to Reproduce:
1. Call WebClient.DownloadData("http://www.google.com/a/b/c")
2. catch (WebException e)
3. Observe e.Status == WebExceptionStatus.UnknownError
Actual Results:  
e.Status == WebExceptionStatus.UnknownError

Expected Results:  
e.Status == WebExceptionStatus.ProtocolError

Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.

More information about the mono-bugs mailing list