Sending Status as 401.1

Discussion in 'ASP .Net' started by =?Utf-8?B?RGh3YW5pbCBTaGFo?=, Feb 23, 2004.

  1. We are trying to refuse data display to users based on some internal criteria. The site uses Basic Authentication for security.

    Through ASP.NET we can send a status of 401. The request to our site comes from an application that understands the HTTP protocol.

    If we send 401, the requsting application comes back to our application with the same user credentials. I read somewhere that 401 does not "exactly" mean access denied. The exact status code is 401.1 or 401.2.

    The Status property of the Response object is an "int" - how can we send something like 401.1 or 401.2 from ASP.NET????

    Thanks
    =?Utf-8?B?RGh3YW5pbCBTaGFo?=, Feb 23, 2004
    #1
    1. Advertising

  2. Hi, Dhwanil Shah,

    I don't understand what you mean by this:

    > If we send 401, the requsting application comes back to our application

    with the same user credentials.

    Do they have a collection of user credentials? Normally every user has one
    set of credentials and if the authentication fails that user can't use the
    service.

    Anyway, here is the list of custom error messages you might try to send:

    http://msdn.microsoft.com/library/en-us/iissdk/iis/customerrormessagesreference.asp

    I havent tested it, but you can try to send:

    Response.Status = "401.2 Unauthorized: Access is denied due to server
    configuration favoring an alternate authentication method.";

    Most likely it will throw an HttpException "Status is set to an invalid
    status code." though.

    Greetings
    Martin
    Martin Dechev, Feb 23, 2004
    #2
    1. Advertising

  3. Hi

    I just need to send the value of 401.1 or 401.2 in Response.Status property. The Response.Status property is an int value i.e. I can only send 401 or 200 i.e. full numbers - no decimals allowed

    How can I send an HTTP status code of 401.1 or 401.2 from ASP.NET

    Thanks & Regard
    Dhwanil Shah
    =?Utf-8?B?RGh3YW5pbCBTaGFo?=, Feb 23, 2004
    #3
  4. Hi, Dhwanil,

    I have not tested this, but you might want to try setting Response.Status to
    4011 or 4012.

    --
    Regards,
    Thomas Johansen (aka. Aylar)

    Dhwanil Shah <> wrote:
    > Hi,
    >
    > I just need to send the value of 401.1 or 401.2 in Response.Status
    > property. The Response.Status property is an int value i.e. I can
    > only send 401 or 200 i.e. full numbers - no decimals allowed.
    >
    > How can I send an HTTP status code of 401.1 or 401.2 from ASP.NET?
    >
    > Thanks & Regards
    > Dhwanil Shah
    Thomas Johansen, Feb 23, 2004
    #4
  5. Hi, Dhwanil Shah,

    The property Status on the System.Web.HttpResponse class is of type System
    String:

    http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemWebHttpResponseClassStatusTopic.asp

    Anyway, it will throw HttpException "HTTP status string is not valid." if
    you try to set it to a custom status code + status message combination.

    Greetings
    Martin
    "Dhwanil Shah" <> wrote in message
    news:...
    > Hi,
    >
    > I just need to send the value of 401.1 or 401.2 in Response.Status

    property. The Response.Status property is an int value i.e. I can only send
    401 or 200 i.e. full numbers - no decimals allowed.
    >
    > How can I send an HTTP status code of 401.1 or 401.2 from ASP.NET?
    >
    > Thanks & Regards
    > Dhwanil Shah
    Martin Dechev, Feb 23, 2004
    #5
  6. Thanks

    I will check that ou

    Regard
    Dhwanil Shah
    =?Utf-8?B?RGh3YW5pbCBTaGFo?=, Feb 23, 2004
    #6
  7. Martin

    Sorry, I think we need to set StatusCode rather then the Status property.

    I am not sure if sending a status code of 401 and Status i.e. description as 401.2 Access Denied will work or not. Also not sure whether .NET Framework will sync the description and the code.... will check out the lead anyway

    Thanks
    Dhwanil
    =?Utf-8?B?RGh3YW5pbCBTaGFo?=, Feb 23, 2004
    #7
  8. Please note that there is no such thing as a 401.1 when it comes to the HTTP
    headers themselves. (Watch using a network sniffer to confirm for
    yourself).

    When you see a 401.1 in IE, what's really happening is that IIS is sending
    down a HTTP/401 error code in that HTTP Result, but the body text provides
    the additional information you're seeing that claims it's really a 401.1

    --
    Thanks,

    Eric Lawrence
    Program Manager
    Assistance and Worldwide Services

    This posting is provided "AS IS" with no warranties, and confers no rights.


    "Dhwanil Shah" <> wrote in message
    news:...
    > We are trying to refuse data display to users based on some internal

    criteria. The site uses Basic Authentication for security.
    >
    > Through ASP.NET we can send a status of 401. The request to our site comes

    from an application that understands the HTTP protocol.
    >
    > If we send 401, the requsting application comes back to our application

    with the same user credentials. I read somewhere that 401 does not "exactly"
    mean access denied. The exact status code is 401.1 or 401.2.
    >
    > The Status property of the Response object is an "int" - how can we send

    something like 401.1 or 401.2 from ASP.NET????
    >
    > Thanks
    Eric Lawrence [MSFT], Feb 23, 2004
    #8
  9. =?Utf-8?B?RGh3YW5pbCBTaGFo?=

    Fixme

    Joined:
    Jun 6, 2008
    Messages:
    1
    Fixme, Jun 6, 2008
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?UG1jZw==?=

    HttpWebRequest & (401) Unauthorized http status code

    =?Utf-8?B?UG1jZw==?=, Jun 21, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    2,403
    =?Utf-8?B?UG1jZw==?=
    Jun 21, 2004
  2. =?Utf-8?B?UGhpbDM5Ng==?=

    WS status 401:Unauthorized

    =?Utf-8?B?UGhpbDM5Ng==?=, Aug 22, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    462
    John Timney \(ASP.NET MVP\)
    Aug 22, 2005
  3. Sachin
    Replies:
    2
    Views:
    17,885
    Sachin
    Nov 4, 2005
  4. ad
    Replies:
    2
    Views:
    13,513
  5. ad
    Replies:
    0
    Views:
    1,618
Loading...

Share This Page