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. Auto Logout ...please tell me the Answer

Auto Logout ...please tell me the Answer

Scheduled Pinned Locked Moved ASP.NET
8 Posts 6 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.
  • P Offline
    P Offline
    pkravikumar
    wrote on last edited by
    #1

    Dear all, Am loging in to my application and i didnt make any transaction, after sesstion timeout if am clicking any form that time loginpage will come, so in this regards i want login page autometically after sesstion timeout.give me solution

    C I A 4 Replies Last reply
    0
    • P pkravikumar

      Dear all, Am loging in to my application and i didnt make any transaction, after sesstion timeout if am clicking any form that time loginpage will come, so in this regards i want login page autometically after sesstion timeout.give me solution

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Your question makes no sense, you seem to say that what is happening, is what you want to happen. You also don't tell us what you mean by 'transaction', how you handle login, etc.

      Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

      G 1 Reply Last reply
      0
      • C Christian Graus

        Your question makes no sense, you seem to say that what is happening, is what you want to happen. You also don't tell us what you mean by 'transaction', how you handle login, etc.

        Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

        G Offline
        G Offline
        Gaurav Dudeja India
        wrote on last edited by
        #3

        Have you try to understand the question, just said that it make no sense.Please dont be in hurry to answer any question first try to understand that.

        C 1 Reply Last reply
        0
        • G Gaurav Dudeja India

          Have you try to understand the question, just said that it make no sense.Please dont be in hurry to answer any question first try to understand that.

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          Am loging in to my application and i didnt make any transaction, What does he mean by 'transaction' ? How is this relevant ? How does his system allow logging in ? If we don't know what the login code is, how can we comment on it ? after sesstion timeout if am clicking any form that time loginpage will come When his session times out if he tries to do anything, then he gets a login page so in this regards i want login page autometically after sesstion timeout.give me solution Oh - I see now. OK, fair enough. It's hardly clear tho.

          Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

          1 Reply Last reply
          0
          • P pkravikumar

            Dear all, Am loging in to my application and i didnt make any transaction, after sesstion timeout if am clicking any form that time loginpage will come, so in this regards i want login page autometically after sesstion timeout.give me solution

            C Offline
            C Offline
            Christian Graus
            wrote on last edited by
            #5

            OK, I managed to decipher this, I THINK. To get the login page to show automatically, you need a javascript timer which fires after the same time as a timeout, and refreshes the page. Then the login page will show. This is rarely what users want, but it will work.

            Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

            L 1 Reply Last reply
            0
            • P pkravikumar

              Dear all, Am loging in to my application and i didnt make any transaction, after sesstion timeout if am clicking any form that time loginpage will come, so in this regards i want login page autometically after sesstion timeout.give me solution

              I Offline
              I Offline
              Imran Khan Pathan
              wrote on last edited by
              #6

              pkravikumar wrote:

              after sesstion timeout if am clicking any form that time loginpage will come, so in this regards i want login page autometically after sesstion timeout.give me solution

              I think he wants to login again automatically into system when session timeout and login page comes.

              please don't forget to vote on the post that helped you.

              1 Reply Last reply
              0
              • P pkravikumar

                Dear all, Am loging in to my application and i didnt make any transaction, after sesstion timeout if am clicking any form that time loginpage will come, so in this regards i want login page autometically after sesstion timeout.give me solution

                A Offline
                A Offline
                Abhishek Sur
                wrote on last edited by
                #7

                Hey pkravikumar, Let me suggest what I do in your situation. 1. I would make an HTTPHandler which redirects every request for ASPX extension. 2. Whenever User Logs in to my system, I would store the UserData in Session using a SessionKey. For example :

                if (Session["ID"] == null))
                context.Session.Add("ID", userid); // you may have any value here.

                3. On every request I would check whether the requested Url leads to Login page or anyother page. If any other page, is the user Logged in already.

                if (Session["ID"] == null && Request.Url.AbsolutePath != loginurl)
                {
                Response.Write("var w = window.parent || window; w.location='" + loginurl + "';");
                Response.Flush();
                Response.End();
                }

                This will also eliminate your problem. If session Timeout occurs, Session["ID"] will have null in it. Thus any other request to page other than loginurl will lead to redirect it to loginurl. I hope you like this solution. Other than that, If you dont want to write a Handler and want to do this in pages, you can see this url : Detecting Session Timeouts[^] Here you will find how to detect new session. :) :thumbsup::rose:

                Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.


                My Latest Articles-->** Microsoft Bing MAP using Javascript
                CLR objects in SQL Server 2005
                Uncommon C# Keywords
                /xml>

                1 Reply Last reply
                0
                • C Christian Graus

                  OK, I managed to decipher this, I THINK. To get the login page to show automatically, you need a javascript timer which fires after the same time as a timeout, and refreshes the page. Then the login page will show. This is rarely what users want, but it will work.

                  Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #8

                  This is exactly what I did in my app and it works like a breeze. And to make the code generic, use a base Page class from which all your aspx code-behind classes derive. In the OnLoad event, use RegisterStartupScript to inject the javascript that refreshes the page. Use Session.Timeout property to determine the timeout in seconds.

                  protected override void OnLoad(EventArgs e) {
                  this.RegsiterStartupScript ("CheckTimeOut",
                  ""
                  + "window.setTimeout(\"document.forms[0].submit();\","
                  + Session.Timeout * 1000 + ");"
                  }

                  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