forms authentication automatic logout without timers?

Ask a Question related to ASP.NET Security, Design and Development.

  1. #1

    Default forms authentication automatic logout without timers?

    Hello,

    I have a web application that uses forms authentication. I have been asked to implement a feature that logs users out automatically if they navigate to a page outside of the secured portion of the web app. This request means that cookie timeouts won't work, it needs to be an instant thing - you leave the site -> the door gets locked on your way out even if you haven't explicitly logged out yourself.

    Does anyone know if this is possible?

    Regards,

    Danny
    Danny Guest

  2. Similar Questions and Discussions

    1. Automatic windows authentication login
      Hi I have 2 intranet sites: Intranet_1 and Intranet_2 both secured using integrated windows authentication in IIS. Using ASP.NET, is there a way...
    2. How logout in code that using Window Authentication?
      Hi, We using Window Autoentication, but we want logout in our code, how should i do? Thanks. Neil.
    3. Basic Authentication Logout
      I have an app with basic authentication turned on. I want to have a logout button. What code do I need to supply in my asp.net to logoff the user...
    4. Automatic htaccess authentication via PHP
      Hi NG, is it possible to achieve an automatic authentication via PHP? What I'm trying to do is, protect one subfolder with htaccess, and then...
    5. Automatic Login - Forms Authentication - Request.ServerVariables["LOGON_USER"]
      Hi there, I'm busy building a site that authenticates users from a database but would like Windows authenticated users to bypass the logon screen...
  3. #2

    Default RE: forms authentication automatic logout without timers?

    Dear Danny,

    In the Page_Load event of the page where you want to logout the users, put the following code:-

    if(User.Identity.IsAuthenticated)
    {
    FormsAuthentication.Signout();
    }

    this will automatically signout user's who are logged in.

    hope it helps.
    "Danny" wrote:
    > Hello,
    >
    > I have a web application that uses forms authentication. I have been asked to implement a feature that logs users out automatically if they navigate to a page outside of the secured portion of the web app. This request means that cookie timeouts won't work, it needs to be an instant thing - you leave the site -> the door gets locked on your way out even if you haven't explicitly logged out yourself.
    >
    > Does anyone know if this is possible?
    >
    > Regards,
    >
    > Danny
    ranganh Guest

  4. #3

    Default forms authentication automatic logout without timers?

    In the Global.asax AuthorizeRequest event, you can add
    code that will check if the user is authenticated and if
    the current url is secure or not. Then, sign the user out
    accordingly:

    Private Sub Global_AuthorizeRequest(ByVal sender As
    Object, ByVal e As System.EventArgs) Handles
    MyBase.AuthorizeRequest
    If User.Identity.IsAuthenticated Then
    If Not
    HttpContext.Current.Request.IsSecureConnection Then

    System.Web.Security.FormsAuthentication.SignOut()
    End If
    End If
    End Sub
    >-----Original Message-----
    >Hello,
    >
    >I have a web application that uses forms authentication.
    I have been asked to implement a feature that logs users
    out automatically if they navigate to a page outside of
    the secured portion of the web app. This request means
    that cookie timeouts won't work, it needs to be an instant
    thing - you leave the site -> the door gets locked on your
    way out even if you haven't explicitly logged out
    yourself.
    >
    >Does anyone know if this is possible?
    >
    >Regards,
    >
    >Danny
    >.
    >
    Sam Guest

  5. #4

    Default RE: forms authentication automatic logout without timers?

    Thank you for the replies.

    Unfortunately I realised last night when I got home that I didn't really state my question correctly so I am closing this question and moving it to a new posting titled 'can you prevent malicious use of browser back button in forms authentication'

    What I actually want to do is this...

    User is logged in and authenticated to use secure sections of site. User then proceeds to navigate to some site outside of the secure sections of the web app (could be any url) but forgets to log out then eventually gets up and walks away from their machine. Some other malicious user then comes along and presses the back button on their browser to see what forgetful user has been looking at.

    I've been asked to somehow prevent that malicious user from being able to gain access to secure content if fogetful user didn't logout and the forms authentication timer on the auth cookie hasn't yet expired.

    I'm really not sure if this is possible.


    "Sam" wrote:
    > In the Global.asax AuthorizeRequest event, you can add
    > code that will check if the user is authenticated and if
    > the current url is secure or not. Then, sign the user out
    > accordingly:
    >
    > Private Sub Global_AuthorizeRequest(ByVal sender As
    > Object, ByVal e As System.EventArgs) Handles
    > MyBase.AuthorizeRequest
    > If User.Identity.IsAuthenticated Then
    > If Not
    > HttpContext.Current.Request.IsSecureConnection Then
    >
    > System.Web.Security.FormsAuthentication.SignOut()
    > End If
    > End If
    > End Sub
    >
    > >-----Original Message-----
    > >Hello,
    > >
    > >I have a web application that uses forms authentication.
    > I have been asked to implement a feature that logs users
    > out automatically if they navigate to a page outside of
    > the secured portion of the web app. This request means
    > that cookie timeouts won't work, it needs to be an instant
    > thing - you leave the site -> the door gets locked on your
    > way out even if you haven't explicitly logged out
    > yourself.
    > >
    > >Does anyone know if this is possible?
    > >
    > >Regards,
    > >
    > >Danny
    > >.
    > >
    >
    Danny Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139