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
  1. Home
  2. Web Development
  3. ASP.NET
  4. How to maintain Login status

How to maintain Login status

Scheduled Pinned Locked Moved ASP.NET
questioncsharpjavascriptasp-nettools
9 Posts 4 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.
  • A Offline
    A Offline
    A Muthunagai
    wrote on last edited by
    #1

    Hi All, I'm developing one application in asp.net 2.0 In that application logged in user can view the pages. If the user close the page with out signing out means how can I maintain their login status? If I use the javascript in body unload means, I have to implement this script in many of the pages. Give some better idea to solve this prob. Thanks in Advance A.Muthunagai

    E N S 3 Replies Last reply
    0
    • A A Muthunagai

      Hi All, I'm developing one application in asp.net 2.0 In that application logged in user can view the pages. If the user close the page with out signing out means how can I maintain their login status? If I use the javascript in body unload means, I have to implement this script in many of the pages. Give some better idea to solve this prob. Thanks in Advance A.Muthunagai

      E Offline
      E Offline
      eyeseetee
      wrote on last edited by
      #2

      What do you mean by

      Muthunagai.A wrote:

      how can I maintain their login status

      please elaborate

      A 1 Reply Last reply
      0
      • A A Muthunagai

        Hi All, I'm developing one application in asp.net 2.0 In that application logged in user can view the pages. If the user close the page with out signing out means how can I maintain their login status? If I use the javascript in body unload means, I have to implement this script in many of the pages. Give some better idea to solve this prob. Thanks in Advance A.Muthunagai

        N Offline
        N Offline
        N a v a n e e t h
        wrote on last edited by
        #3

        Muthunagai.A wrote:

        If the user close the page with out signing out means how can I maintain their login status?

        Are you maintaining any DB flags for user status ? Usually you need to check the session existence in each page_load. If session is not exist, redirect user to the login page.

        All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions

        1 Reply Last reply
        0
        • E eyeseetee

          What do you mean by

          Muthunagai.A wrote:

          how can I maintain their login status

          please elaborate

          A Offline
          A Offline
          A Muthunagai
          wrote on last edited by
          #4

          Yes,Maintain the username in a session,if there is a null value means,I will redirect to login page. There is no prob in that. What I want is ,if the user suddenly used the window after logged in means how can I capture their status? and how to update the Database? I updated the Databse for login status in sign out button click and session_end of Global.asax. There are many pages in my application,after login.So How to update the database when the user suddenly closed the browser window?

          1 Reply Last reply
          0
          • A A Muthunagai

            Hi All, I'm developing one application in asp.net 2.0 In that application logged in user can view the pages. If the user close the page with out signing out means how can I maintain their login status? If I use the javascript in body unload means, I have to implement this script in many of the pages. Give some better idea to solve this prob. Thanks in Advance A.Muthunagai

            S Offline
            S Offline
            Sandeep Akhare
            wrote on last edited by
            #5

            There is one more way Create a base class that will have a method which check the session if user is logged in or not call that method from page load of base class Now your page should derived from this base class Now if user closes the browser you want to sign out user Create a cookie like person id for the session level and check that cookie if user close the browser without sign out, then cookie will also get deleted now if he open in new browser the cookie will not be available

            Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "

            A 2 Replies Last reply
            0
            • S Sandeep Akhare

              There is one more way Create a base class that will have a method which check the session if user is logged in or not call that method from page load of base class Now your page should derived from this base class Now if user closes the browser you want to sign out user Create a cookie like person id for the session level and check that cookie if user close the browser without sign out, then cookie will also get deleted now if he open in new browser the cookie will not be available

              Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "

              A Offline
              A Offline
              A Muthunagai
              wrote on last edited by
              #6

              if the user clear the cookies means how can we maintain the status? Any other idea? other then this?

              S 1 Reply Last reply
              0
              • S Sandeep Akhare

                There is one more way Create a base class that will have a method which check the session if user is logged in or not call that method from page load of base class Now your page should derived from this base class Now if user closes the browser you want to sign out user Create a cookie like person id for the session level and check that cookie if user close the browser without sign out, then cookie will also get deleted now if he open in new browser the cookie will not be available

                Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "

                A Offline
                A Offline
                A Muthunagai
                wrote on last edited by
                #7

                If the system suddenly hang or shoutdown means,how to maintain the login status?

                S 1 Reply Last reply
                0
                • A A Muthunagai

                  If the system suddenly hang or shoutdown means,how to maintain the login status?

                  S Offline
                  S Offline
                  Sandeep Akhare
                  wrote on last edited by
                  #8

                  Muthunagai.A wrote:

                  If the system suddenly hang

                  Ya you should not logged out the user but at certain interval of time, If it exceeds more than 20 min(depends on business ) your session should expired so user need to logged in again.

                  Muthunagai.A wrote:

                  shoutdown means,how to maintain the login status?

                  If system get shut down then you should not maintain the status as logged in user. The user should not logged in by default after Restarting the machine. As there should be a new session for that user

                  Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "

                  1 Reply Last reply
                  0
                  • A A Muthunagai

                    if the user clear the cookies means how can we maintain the status? Any other idea? other then this?

                    S Offline
                    S Offline
                    Sandeep Akhare
                    wrote on last edited by
                    #9

                    First tell me what problem are you facing when user closes the browser without logged out. And open the application in new browser.

                    Muthunagai.A wrote:

                    if the user clear the cookies means how can we maintain the status?

                    If user clears the cookie he will redirect to login page

                    Muthunagai.A wrote:

                    Any other idea?

                    No friend, i don't see any other idea as you need to use client side state management for this as server never knows about the browser states whether it is open or closed :)

                    Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "

                    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