Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Session does not expire

Session does not expire

Scheduled Pinned Locked Moved ASP.NET
debugginghelpquestion
7 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    just4ulove7
    wrote on last edited by
    #1

    I am facing a typical problem in my application. The session doesnot expire even though after shutting down my system. For debuggine reasons, I put timeout = 1. What else should I debug to know the problem? Heres the code... Web.config In Global.asax Application_AuthenticateRequest { string userInformation = newUser.Id + ";" + newUser.RoleName + ";" + newUser.UserName + ";" + newUser.LoginId + ";" + newUser.DefaultProject + ";" + HasReportees; FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1,newUser.UserName,DateTime.Now,DateTime.Now.AddMinutes(1),false,userInformation); //Encrypt the ticket string cookieString = FormsAuthentication.Encrypt(ticket); //Send the cookie to the client Response.Cookies["userRoles"].Value=cookieString; Response.Cookies["userRoles"].Path="/"; Response.Cookies["userRoles"].Expires=DateTime.Now.AddMinutes(1); } Am I missing something? Please let me know...:( Thanks

    A G 2 Replies Last reply
    0
    • J just4ulove7

      I am facing a typical problem in my application. The session doesnot expire even though after shutting down my system. For debuggine reasons, I put timeout = 1. What else should I debug to know the problem? Heres the code... Web.config In Global.asax Application_AuthenticateRequest { string userInformation = newUser.Id + ";" + newUser.RoleName + ";" + newUser.UserName + ";" + newUser.LoginId + ";" + newUser.DefaultProject + ";" + HasReportees; FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1,newUser.UserName,DateTime.Now,DateTime.Now.AddMinutes(1),false,userInformation); //Encrypt the ticket string cookieString = FormsAuthentication.Encrypt(ticket); //Send the cookie to the client Response.Cookies["userRoles"].Value=cookieString; Response.Cookies["userRoles"].Path="/"; Response.Cookies["userRoles"].Expires=DateTime.Now.AddMinutes(1); } Am I missing something? Please let me know...:( Thanks

      A Offline
      A Offline
      Albert Pascual
      wrote on last edited by
      #2

      I the session is InProc means that is stored in memory, even uploading a NEW DLL will expire all sessions. So rebooting the computer WILL restart the Sessions. Are you sure you are not using SQL or ServerState? Al

      J 1 Reply Last reply
      0
      • A Albert Pascual

        I the session is InProc means that is stored in memory, even uploading a NEW DLL will expire all sessions. So rebooting the computer WILL restart the Sessions. Are you sure you are not using SQL or ServerState? Al

        J Offline
        J Offline
        just4ulove7
        wrote on last edited by
        #3

        Yes, I am using InProc for the session. Heres the web.config code I dont understand what am I missing? Thanks

        1 Reply Last reply
        0
        • J just4ulove7

          I am facing a typical problem in my application. The session doesnot expire even though after shutting down my system. For debuggine reasons, I put timeout = 1. What else should I debug to know the problem? Heres the code... Web.config In Global.asax Application_AuthenticateRequest { string userInformation = newUser.Id + ";" + newUser.RoleName + ";" + newUser.UserName + ";" + newUser.LoginId + ";" + newUser.DefaultProject + ";" + HasReportees; FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1,newUser.UserName,DateTime.Now,DateTime.Now.AddMinutes(1),false,userInformation); //Encrypt the ticket string cookieString = FormsAuthentication.Encrypt(ticket); //Send the cookie to the client Response.Cookies["userRoles"].Value=cookieString; Response.Cookies["userRoles"].Path="/"; Response.Cookies["userRoles"].Expires=DateTime.Now.AddMinutes(1); } Am I missing something? Please let me know...:( Thanks

          G Offline
          G Offline
          Guffa
          wrote on last edited by
          #4

          Why do you think that the session does not expire? --- b { font-weight: normal; }

          J 1 Reply Last reply
          0
          • G Guffa

            Why do you think that the session does not expire? --- b { font-weight: normal; }

            J Offline
            J Offline
            just4ulove7
            wrote on last edited by
            #5

            When I type the URL, it redirects me directly to the default page which I have specified. However I have the following code thanks..

            G 1 Reply Last reply
            0
            • J just4ulove7

              When I type the URL, it redirects me directly to the default page which I have specified. However I have the following code thanks..

              G Offline
              G Offline
              Guffa
              wrote on last edited by
              #6

              I'm don't know much how the authentication works, but doesn't it use the cookie that you created, rather than the session? You can write out Session.SessionID on the page to clearly determine if the session expires or not. If the id changes, you have a new session object. --- b { font-weight: normal; }

              J 1 Reply Last reply
              0
              • G Guffa

                I'm don't know much how the authentication works, but doesn't it use the cookie that you created, rather than the session? You can write out Session.SessionID on the page to clearly determine if the session expires or not. If the id changes, you have a new session object. --- b { font-weight: normal; }

                J Offline
                J Offline
                just4ulove7
                wrote on last edited by
                #7

                Hmmm....i checked it out putting Session.SessionId. Closing the browser and reopening it creates a new session. My problem was rather with cookies. I was creating persistent cookies. Anyways I have changed the code... Thanks a lot for ur help.

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups