« Previous Next »

Answered Thread: Adding a new header in ISAPI filter (onPreProc)

Last post 09-24-2009 7:15 PM by anilr. 7 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (8 items)

Sort Posts:

  • 08-18-2005, 5:10 AM

    Adding a new header in ISAPI filter (onPreProc)

    I have an ISAPI filter to listen to particular URL patterns like http://lavanyadeepak/myblogs/lavanya/ http://lavanyadeepak/myblogs/deepak/ The filter needs to redirect to a particular webpage called http://lavanyadeepak/webpagerouter.aspx

    The filter would actually set a header called X-BlogName (to deepak or lavanya or whatever). My WebForm would then read the data from database based on this Header value (Request.Headers collection) and display the appropriate weblog.

    The problem is that ISAPI filter is able to set the Header but the header does not come in the Request.Headers collection in webpagerouter.aspx

    Any idea where it is getting disturbed?

    ------------------------------

    Deepak Vasudevan

    http://lavanyadeepak.blogspot.com/

    -------
  • 09-06-2005, 9:26 AM In reply to

    Re: Adding a new header in ISAPI filter (onPreProc)

    Got it!

    Actually, it seems we can not set new headers in the specified event notification.
    ------------------------------

    Deepak Vasudevan

    http://lavanyadeepak.blogspot.com/

    -------
  • 05-08-2009, 5:25 AM In reply to

    Re: Adding a new header in ISAPI filter (onPreProc)

    Hi ,

     my problem sounds same but its with ISAPI filter

     i wrote  a simple ISAPI filter...
    which should authenticate automatically without prompting for username and password.
    the username and password are base64 encoded.

     the code snippet looks like :

            wsprintf(szTemp, "Basic %s:%s",encodedUsername,encodedPassword);
            pHeaderInfo->SetHeader(pCtxt->m_pFC, "Authorization:", szTemp);

            return SF_STATUS_REQ_HANDLED_NOTIFICATION;

     

    i tried with addheader too but no luck. 

    please help what change i should make it to work.

    thanks,

    narayanspg

  • 05-08-2009, 9:18 AM In reply to

    Re: Adding a new header in ISAPI filter (onPreProc)

     hey i got it working by the end of the day.....

    thanks

    i shd have to use base64 on username:password

    but i was previosly doing on separate strings...

    thanks guys

     narayanspg
  • 09-16-2009, 7:37 AM In reply to

    • test_win
    • Not Ranked
    • Joined on 08-31-2009, 6:33 AM
    • Posts 4

    Re: Adding a new header in ISAPI filter (onPreProc)

    Below is the scenario for a virtual directory following are the setting in IIS

    1. Enable Anonymous Access is DISABLED (check box is unchecked).
    2. Integrated Windows Authentication is DISABLED (check box is unchecked)
    3. Basic authentication is ENABLED (checkbox is selected)

    In the web.config of the web application (for the same virtual directory above) the setting is as follows:

    <authentication mode="Windows" />
          <authorization>
            <allow users="?" />
          </authorization>

    When I browse an aspx page of the above web application it asks for username and password.

    User enters username and password (in the dialog which appears as a part of windows authentication).

    I can get the username that user has entered) if the login is successful.

    Is there any way I can get the username(that user has entered) even if the login fails.

    Regards,
    Deepak

  • 09-16-2009, 11:46 AM In reply to

    • anilr
    • Top 10 Contributor
    • Joined on 05-23-2006, 10:13 PM
    • Redmond, WA
    • Posts 2,343

    Re: Adding a new header in ISAPI filter (onPreProc)

    For basic auth, you can because the username/password is in cleartext in the request, you can either parse the authorization header yourselves, or the AUTH_USER server-variable is set for basic auth after authentication even in case of failure.  You would not be able to do this for integrated windows auth.

    Anil Ruia
    Senior Software Design Engineer
    IIS Core Server
  • 09-17-2009, 7:42 AM In reply to

    • test_win
    • Not Ranked
    • Joined on 08-31-2009, 6:33 AM
    • Posts 4

    Re: Adding a new header in ISAPI filter (onPreProc)

    How to parse the authorization header?

    What exactly we need to check in authorization header?

    How to check it integrated windows authentication.

    Can you please provide with some sample code / link

  • 09-24-2009, 7:15 PM In reply to

    • anilr
    • Top 10 Contributor
    • Joined on 05-23-2006, 10:13 PM
    • Redmond, WA
    • Posts 2,343

    Re: Adding a new header in ISAPI filter (onPreProc)

    Basic authentication header is documented in rfc 2617.  For windows auth, there is no way to get the username in case of authentication failure.

    Anil Ruia
    Senior Software Design Engineer
    IIS Core Server
Page 1 of 1 (8 items)
Microsoft Communities