Women in Technology

Hear us Roar



Article:
  ASP.NET Forms Authentication, Part 2
Subject:   Force AD Login in asp.net from all pages.
Date:   2005-09-15 10:07:12
From:   tward3017
Can some give me an example of how in asp.net I can force a user who attempts to browse a page to be directed to the AD Login page.
Example: http://sitename/login.aspx
User tries to get to http://sitename/subdir/page.aspx I need them to be redirected to the login page and maintain authentication to any page after successfully authentication other wise they constantly get the loginpage.aspx.
Full Threads Oldest First

Showing messages 1 through 1 of 1.

  • Force AD Login in asp.net from all pages.
    2005-09-19 23:24:41  najeemmillyas [View]

    Hi,

    You may set a session variable immediately after login success.Also you may chech the session set or not while a page is accessing.If session session not set then redirect the user to login page

    Sample code

    'login.aspx:

    'after athentication success

    session("sess_var")="36136jdasd"


    'under page load event of protected page

    if (Session("sess_var")="")

    Response.redirect("login.aspx")

    End if

    place the above code in any page u need to protect.

    Regards,

    Najeem

    http://www.najsoftindia.com