dont open pop up on session expire

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • veenna
    New Member
    • Dec 2007
    • 65

    dont open pop up on session expire

    Hi all,

    I have a page in asp.net. A button click in the page will open a pop-up. I have used btn.attributes. add("onclick", ""); to open the pop-up.

    Now if session is expired, it is opening the pop-up window and in the pop-up it is showing the login screen.

    Is there any way in which i can avoid pop-up being opened if the session is expired?

    Thanks in advance.
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    There is probably a way (send the button click event to the server, check if session is expired, if not send back the JavaScript that opens the child browser) but, for pop up pages I prefer to hide the regular content and display a message when Session has expired instead of redirecting them to the login page.

    -Frinny

    Comment

    • semomaniz
      Recognized Expert New Member
      • Oct 2007
      • 210

      #3
      I would use ajax Modal Popup for this. If the session has expired then it will redirect the page to login.

      Comment

      • ThatThatGuy
        Recognized Expert Contributor
        • Jul 2009
        • 453

        #4
        Session expires when browser is closed....

        your syntax is wrong...

        btn.attributes. add("onclick", "");

        the second argument of the Add method must contain the client side javascrupt function to be called....

        btn.attributes. add("onclick", "hello()");

        then you must also create a client function named hello() in the aspx code...

        then it will work

        Comment

        • Frinavale
          Recognized Expert Expert
          • Oct 2006
          • 9749

          #5
          Session doesn't exactly expire when the browser closes...

          Especially with regards to child browsers being opened. If the child browser is closed and the parent browser is opened then the Session identifier (a cookie) will still exist. This means that the Session is still active. You can configure the Session identifier cookies to be persistent also which means that when the user closes the browser the Session identifier will still be there the next time the user opens the browser.

          Session exists on the server. By default session is InProc and times out after 20 minutes. You can configure Session differently so that it doesn't use InProc or doesn't expire for a longer period of time.

          So, when you say that the Session expires when the user closes the browser it's not quite right. Session is on the server and (by default) when there is no activity from the user after 20 minutes Session will time out.

          -Frinny

          Comment

          Working...