[Mono-bugs] [Bug 405238] New: HttpWebResponse. StatusCode is not accessible after response was disposed (unlike MS .NET)

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Jul 1 01:21:24 EDT 2008


           Summary: HttpWebResponse.StatusCode is not accessible after
                    response was disposed (unlike MS .NET)
           Product: Mono: Class Libraries
           Version: 1.9.0
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: System
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: Ayende at ayende.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---

Description of Problem:
HttpWebResponse.StatusCode perform a check to ensure that the response was not
This cause an issue when dealing with web services and needing to check on the
returned status of an exception.

As a simple example, let us say that I need to check if the user supplied the
wrong credentials, on MS .NET I can use this code:

    return tfsWebService.DoSomething();
catch(WebException we)
    HttpWebResponse r = we.Response as r;
    if( r != null && r.StatusCode == HttpStatusCode.Unauthorized )
          throw new NetworkAccessDeniedException(we);       

but on mono r.StatusCode will throw ObjectDisposedException.

Steps to reproduce the problem:
1. Create a web request that would generate a failure (such as by calling
authenticated website with the wrong password)
2. Disposed on the response from the WebException
3. Attempt to access the response StatusCode property

Alternatively, use the code above.

Actual Results:
ObjectDisposedException is thrown

Expected Results:
An exception should not be thrown.

How often does this happen? 

Additional Information:

Different behavior from MS .NET

Blocker bug for porting the SvnBridge project to Mono

Configure bugmail: https://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