HttpContext.Current.User.Identity.Name loses value

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Doogie

    HttpContext.Current.User.Identity.Name loses value

    Hi,
    I am using HttpContext.Cur rent.User.Ident ity.Name to get a user id
    from a web application. I then use that as part of a name of a cookie
    I'm writing. 30 minutes later I do a refresh of this page and try to
    access that cookie. However, because I am using
    HttpContext.Cur rent.User.Ident ity.Name to get the user id to know what
    that cookie name even is, I am having problems because apparently
    after 30 minutes HttpContext.Cur rent.User.Ident ity.Name is no longer
    returning a value. I think it has something to do with session
    information only being available for 20 minutes by default.

    Is there another way to get the user id other than
    HttpContext.Cur rent.User.Ident ity.Name?

  • bruce barker

    #2
    Re: HttpContext.Cur rent.User.Ident ity.Name loses value

    in asp.net, authentication is independent of session. if its not set,
    then you page is not requiring authentication.

    -- bruce (sqlwork.com)

    Doogie wrote:
    Hi,
    I am using HttpContext.Cur rent.User.Ident ity.Name to get a user id
    from a web application. I then use that as part of a name of a cookie
    I'm writing. 30 minutes later I do a refresh of this page and try to
    access that cookie. However, because I am using
    HttpContext.Cur rent.User.Ident ity.Name to get the user id to know what
    that cookie name even is, I am having problems because apparently
    after 30 minutes HttpContext.Cur rent.User.Ident ity.Name is no longer
    returning a value. I think it has something to do with session
    information only being available for 20 minutes by default.
    >
    Is there another way to get the user id other than
    HttpContext.Cur rent.User.Ident ity.Name?
    >

    Comment

    • Doogie

      #3
      Re: HttpContext.Cur rent.User.Ident ity.Name loses value

      I'm not dealing with authentication. I'm trying to read the value in
      that HttpContext.Cur rent.User.Ident ity.Name value and it goes away
      after 30 minutes. First time I go through it's there.


      Comment

      • Jim in Arizona

        #4
        Re: HttpContext.Cur rent.User.Ident ity.Name loses value

        Doogie wrote:
        Hi,
        I am using HttpContext.Cur rent.User.Ident ity.Name to get a user id
        from a web application. I then use that as part of a name of a cookie
        I'm writing. 30 minutes later I do a refresh of this page and try to
        access that cookie. However, because I am using
        HttpContext.Cur rent.User.Ident ity.Name to get the user id to know what
        that cookie name even is, I am having problems because apparently
        after 30 minutes HttpContext.Cur rent.User.Ident ity.Name is no longer
        returning a value. I think it has something to do with session
        information only being available for 20 minutes by default.
        >
        Is there another way to get the user id other than
        HttpContext.Cur rent.User.Ident ity.Name?
        >
        There's Request.ServerV irables("AUTH_U SER") (or LOGON_USER i believe,
        which gives same result if i remember correctly)
        However, this property also comes out of httpcontext:

        HttpContext.Cur rent.Applicatio nInstance.Reque st.ServerVirabl es("AUTH_USER" )

        I don't know if that will solve you problem or not.

        Comment

        • Doogie

          #5
          Re: HttpContext.Cur rent.User.Ident ity.Name loses value

          Since it's part of HttpContext I'm guessing it'll be an issue as well,
          but thank you. I did find out that if I do my refresh before the 20
          minutes (say every 15), I don't lose that info in the HttpContext
          object. It stays for quite some time (until my cookie expires and I
          have to reget all my info then it goes away). Not sure why this is
          but I think that's what I'll go with.

          Comment

          Working...