Forms authentication with Active Directory

Discussion in 'ASP .Net' started by Author, Jan 7, 2009.

  1. Author

    Author Guest

    In my web application I use forms authentication with active
    directory. This is working just fine.

    Because only a small subset of our domain users are allowed to access
    the web application, I keep a Users table for the application in the
    SQL Sever 2005 database.

    The rationale is this:

    After a user is AD-authenticated, I check if the user name exists in
    the Users table in the database, if not, I would like to fail the
    authentication.

    Here is what I am doing:

    In the Login.aspx page, I have a login control, and there is nothing
    in the code-behind.

    Once a user is AD-authenticated, the application redirects the user to
    Default.aspx, because in web.config I have

    <authentication mode="Forms">
    <forms
    name=".ADAuthCookie" loginUrl="Login.aspx"
    defaultUrl="Default.aspx"
    timeout="10" />
    </authentication>

    In Default.aspx.cs, I check if the user is in the Users table in the
    database. If not, I kick the user back to the Login.aspx page through
    this:

    Session.Abandon();
    FormsAuthentication.SignOut();
    FormsAuthentication.RedirectToLoginPage();

    But, how do I nicely show the FailureText of the Login control if the
    user is AD-authenticated, but not in the Users table?

    I hope that I have made the situation clear. Thank you.
     
    Author, Jan 7, 2009
    #1
    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. techfuzz
    Replies:
    1
    Views:
    1,345
    Yan-Hong Huang[MSFT]
    Aug 12, 2003
  2. Marty Underwood

    Forms Authentication +Active Directory +Roles

    Marty Underwood, Oct 29, 2003, in forum: ASP .Net
    Replies:
    4
    Views:
    731
    Marty Underwood
    Oct 30, 2003
  3. - Steve -
    Replies:
    7
    Views:
    2,414
    - Steve -
    Jun 4, 2004
  4. =?Utf-8?B?RWdiZXJ0?=

    Asp.Net Forms authentication using Active Directory

    =?Utf-8?B?RWdiZXJ0?=, Nov 3, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    553
    =?Utf-8?B?RWdiZXJ0?=
    Nov 3, 2004
  5. Tdar
    Replies:
    2
    Views:
    8,976
    Arnel
    Oct 11, 2005
Loading...

Share This Page