Implementing "Remember Me"

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

  1. #1

    Default Implementing "Remember Me"

    Our site uses forms authentication where we always store the username in a
    session("UserName"). We get that username from the logon screen. Now we
    are implementing a "remember Me" checkbox where, if selected, we will call
    FormsAuthentication.RedirectFromLoginPage(txtUser. value,
    chkPersist.checked).

    This works but the next time the remembered user logs in, they don't go
    through our login page and the session("UserName") doesn't get set. I
    suppose the the user name is inthe cookie but what property or method can I
    use to retrieve it?
    Thanks,
    Gary


    Gary Guest

  2. Similar Questions and Discussions

    1. Checking "Remember Password" Does Not Work
      We have a client who is using Contribute 3.1 under Windows 98 to connect to a site hosted on our Publishing Services server. When you first start up...
    2. CFINPUT type="radio" w/ "value" requires "label"
      On a Flash form, when you specify type='radio' and value='whatever', the value of the 'value' attribute will be displayed as a label if no 'label'...
    3. Can Form Elements "Remember" Their Settings?
      A newbie question: I'm building a web page with a form including a number of checkboxes, radio buttons, text entry boxes, etc. Clicking the...
    4. Implementing "Forget Me"
      We have implemented "Remember Me" with the following call: FormsAuthentication.RedirectFromLoginPage(txtUsername, cbRememberMe.checked) We have...
    5. "Dern, can't remember that there command."
      Thanks again. Dave "Bullschmidt" <paul@bullschmidt.com-nospam> wrote in message news:eESifquWDHA.1536@TK2MSFTNGP11.phx.gbl...
  3. #2

    Default Re: Implementing "Remember Me"

    Hi,

    the name should be available just by using:

    User.Identity.Name

    --
    Teemu Keiski
    MCP, Microsoft MVP (ASP.NET), AspInsiders member
    ASP.NET Forum Moderator, AspAlliance Columnist


    "Gary" <gb@nospam.com> wrote in message
    news:eQgMc6H1DHA.1736@TK2MSFTNGP09.phx.gbl...
    > Our site uses forms authentication where we always store the username in a
    > session("UserName"). We get that username from the logon screen. Now we
    > are implementing a "remember Me" checkbox where, if selected, we will call
    > FormsAuthentication.RedirectFromLoginPage(txtUser. value,
    > chkPersist.checked).
    >
    > This works but the next time the remembered user logs in, they don't go
    > through our login page and the session("UserName") doesn't get set. I
    > suppose the the user name is inthe cookie but what property or method can
    I
    > use to retrieve it?
    > Thanks,
    > Gary
    >
    >

    Teemu Keiski Guest

  4. #3

    Default Re: Implementing "Remember Me"

    if you are using FormsAuthentication, you really don;t need to waste a
    session variable for storing the username.

    Using HttpContext.Current.User.Identity.Name should return the "username"
    value stored in the authentication cookie.

    If you still want to store it in a session variable, then trap one of the
    application events (like session_onstart, but i am not sure.) and assign the
    above value to a session variable.

    Regards,
    Nauzad Kapadia [MVP]


    "Gary" <gb@nospam.com> wrote in message
    news:eQgMc6H1DHA.1736@TK2MSFTNGP09.phx.gbl...
    > Our site uses forms authentication where we always store the username in a
    > session("UserName"). We get that username from the logon screen. Now we
    > are implementing a "remember Me" checkbox where, if selected, we will call
    > FormsAuthentication.RedirectFromLoginPage(txtUser. value,
    > chkPersist.checked).
    >
    > This works but the next time the remembered user logs in, they don't go
    > through our login page and the session("UserName") doesn't get set. I
    > suppose the the user name is inthe cookie but what property or method can
    I
    > use to retrieve it?
    > Thanks,
    > Gary
    >
    >

    Nauzad Kapadia 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