how to destroy session

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shashank narayan
    New Member
    • Mar 2010
    • 11

    how to destroy session

    actually i m developing a web and in this web i want to do some interesting work. so i want to log out a user after warn him after some given time . i mean to say that when a user log in in the sigh then his time of accessing sigh will be getched from data base . and according to that database time user can access the sigh .
    ex: suppose accessing time is 10 minutes. after log in our sigh person can use that sigh for given 10 min after 8 min a message will display that your time is going to expire so finish your work as soon as possible.and it is also mentioned that person can switch from any page to any other page in the sigh can perform any work or person can be idle for his time but we have to strictly log out person after fix time. so help me
    i m using asp.net and ms access as database and no new technology is not needed in that project . we can only use java script in project. i have also used master page in my project .so please help me
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    You have stated a lot of things that you need to do.

    What are you having problems with?
    What are have you tried so far to solve the problem?

    If you are looking to end a user's session then you can use the Session.Abandon Method to abandon the session that the user is currently working with....

    You can set the Session to expire automatically after a given time using the web.config for the site.

    Or you could store the time that the user logged in into Session and every time the page is loaded you want to compare the login time in Session to the current time to see if their time has finished.

    In order to do things client side you probably also want to store the login time into a HiddenField so that you can access it from JavaScript.

    You should also store the login time into the HiddenField so that you can access it in JavaScript as well.

    You would then want to use the JavaScript setinterval to create a timer for when to display the message.

    Be aware that the user's clock may differ from the server's clock and therefore you're going to want to store both the login time and the current time into HiddenFields to try and synchronize this as much as possible....



    -Frinny

    Comment

    • PRR
      Recognized Expert Contributor
      • Dec 2007
      • 750

      #3
      You can look into Session timeout.

      Also for certain pages, you can check whether session is valid or not. If not then redirect. This will only happen when the user will request/ post some data to the web server.

      Comment

      • shashank narayan
        New Member
        • Mar 2010
        • 11

        #4
        actually i want to redirect to page after finishing the time without posting any data to server
        .as you see in online exams a person is automatically log out after finishing the time .in this i want to add specific time for specific user.this is all i want .simply
        i want to develop a site in which a user can work untill his time expires and after expiring he will be redirect to a page . and time for persons tp access site will be differ

        Comment

        • Frinavale
          Recognized Expert Expert
          • Oct 2006
          • 9749

          #5
          Shashank,

          It's wonderful that you would like to do this.
          We are here to help you through problems that you are facing but we aren't going to do the work for you

          What have you tried so far?
          What problems are you having?
          Have you considered trying anything that I mentioned in my previous post?


          -Frinny

          Comment

          Working...