How to kill a web page?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Steve Kershaw

    #1

    How to kill a web page?

    Hi,

    I have an ASP.Net web page that has a timer that needs to be killed
    when the timer fires off. How can I do this from the master.page?

    Thanks
    Steve

  • George Ter-Saakov

    #2
    Re: How to kill a web page?

    Kill is a bad word :)
    My guess you want to log user out after some timeout?

    Simply have your master.page to output following JavaScript

    <script>
    function TimeOut()
    {
    window.location ="/logout.aspx"
    }
    window.setTimeo ut("TimeOut();" , 15 minutes);

    See help on setTimeout function in Javascript (not in .NET).

    <script>
    George.




    "Steve Kershaw" <steve_kershaw@ yahoo.comwrote in message
    news:1176837871 .405233.310780@ y5g2000hsa.goog legroups.com...
    Hi,
    >
    I have an ASP.Net web page that has a timer that needs to be killed
    when the timer fires off. How can I do this from the master.page?
    >
    Thanks
    Steve
    >

    Comment

    • Mark Rae

      #3
      Re: How to kill a web page?

      "George Ter-Saakov" <gt-nsp@cardone.com wrote in message
      news:eCaIBnSgHH A.4552@TK2MSFTN GP04.phx.gbl...
      <script>
      Change this to:

      <script type="text/javascript">
      window.setTimeo ut("TimeOut();" , 15 minutes);
      This will throw an exception because the second argument of the
      window.setTimeo ut method requires an integer value denoting the number of
      milliseconds to delay:

      window.setTimeo ut("TimeOut();" , 900000);


      Comment

      • Steve Kershaw

        #4
        Re: How to kill a web page?

        On Apr 17, 3:25 pm, "Mark Rae" <m...@markNOSPA Mrae.netwrote:
        "George Ter-Saakov" <gt-...@cardone.com wrote in message
        >
        news:eCaIBnSgHH A.4552@TK2MSFTN GP04.phx.gbl...
        >
        <script>
        >
        Change this to:
        >
        <script type="text/javascript">
        >
        window.setTimeo ut("TimeOut();" , 15 minutes);
        >
        This will throw an exception because the second argument of the
        window.setTimeo ut method requires an integer value denoting the number of
        milliseconds to delay:
        >
        window.setTimeo ut("TimeOut();" , 900000);
        Is there anyway to logout someone or drop the Web Page in C#???
        Steve

        Comment

        • Steve Kershaw

          #5
          Re: How to kill a web page?

          On Apr 17, 3:25 pm, "Mark Rae" <m...@markNOSPA Mrae.netwrote:
          "George Ter-Saakov" <gt-...@cardone.com wrote in message
          >
          news:eCaIBnSgHH A.4552@TK2MSFTN GP04.phx.gbl...
          >
          <script>
          >
          Change this to:
          >
          <script type="text/javascript">
          >
          window.setTimeo ut("TimeOut();" , 15 minutes);
          >
          This will throw an exception because the second argument of the
          window.setTimeo ut method requires an integer value denoting the number of
          milliseconds to delay:
          >
          window.setTimeo ut("TimeOut();" , 900000);
          That worked! But I can still click the back button and return to the
          previous page which is a problem here!!! If the timeout happends then
          the current page must either be "killed" or the new page must not have
          any reference BACK to the old page!

          Thanks again for your help.

          Steve

          Comment

          • Mark Rae

            #6
            Re: How to kill a web page?

            "Steve Kershaw" <steve_kershaw@ yahoo.comwrote in message
            news:1176911434 .832421.174200@ y80g2000hsf.goo glegroups.com.. .
            That worked! But I can still click the back button and return to the
            previous page which is a problem here!!! If the timeout happends then
            the current page must either be "killed" or the new page must not have
            any reference BACK to the old page!
            Despite what some people will tell, there is really no 100% reliable way of
            disabling the back button...


            Comment

            • George Ter-Saakov

              #7
              Re: How to kill a web page?

              You can add following code to your every page
              Response.CacheC ontrol = "no-cache";

              Response.Expire s = -1;

              Theoretically that prevents caching and if user clicks back button browser
              forced to send a request to the server (which in turn should redirect user
              to login page if Session has expired)

              worked for me although I did not do extensive testing with all browsers that
              out there.

              George.



              "Steve Kershaw" <steve_kershaw@ yahoo.comwrote in message
              news:1176911434 .832421.174200@ y80g2000hsf.goo glegroups.com.. .
              On Apr 17, 3:25 pm, "Mark Rae" <m...@markNOSPA Mrae.netwrote:
              >"George Ter-Saakov" <gt-...@cardone.com wrote in message
              >>
              >news:eCaIBnSgH HA.4552@TK2MSFT NGP04.phx.gbl.. .
              >>
              <script>
              >>
              >Change this to:
              >>
              ><script type="text/javascript">
              >>
              window.setTimeo ut("TimeOut();" , 15 minutes);
              >>
              >This will throw an exception because the second argument of the
              >window.setTime out method requires an integer value denoting the number of
              >milliseconds to delay:
              >>
              >window.setTime out("TimeOut(); ", 900000);
              >
              That worked! But I can still click the back button and return to the
              previous page which is a problem here!!! If the timeout happends then
              the current page must either be "killed" or the new page must not have
              any reference BACK to the old page!
              >
              Thanks again for your help.
              >
              Steve
              >

              Comment

              Working...