After gmail logs out, cannot go back through browser back button

Discussion in 'ASP .Net' started by Author, Jan 18, 2009.

  1. Author

    Author Guest

    After we log out gmail, if we then click on the back button of our
    browser, we cannot go back to our inbox. I've tried both Firefox and
    IE, both work nicely like this. How did they achieve this?

    In my asp.net web application using forms authentication, one can
    still go back through the browser back button after one logs out my
    application, although, clicking on anything will still kick the user
    out.

    How can I also prevent people from going back through the browser back
    button after one has logged out, just like gmail?

    Thanks a lot.
    Author, Jan 18, 2009
    #1
    1. Advertising

  2. Author

    Author Guest

    On Jan 18, 12:04 pm, Author <> wrote:
    > After we log out gmail, if we then click on the back button of our
    > browser, we cannot go back to our inbox.  I've tried both Firefox and
    > IE, both work nicely like this.  How did they achieve this?
    >
    > In my asp.net web application using forms authentication, one can
    > still go back through the browser back button after one logs out my
    > application, although, clicking on anything will still kick the user
    > out.
    >
    > How can I also prevent people from going back through the browser back
    > button after one has logged out, just like gmail?
    >
    > Thanks  a lot.


    OK, I've tried all kinds of suggestions such as history.forward(1);
    onload = "if(history.length>0)history.go(+1);" It just does not work.

    Does anyone know of a solution that *really* works, like that of gmail
    logout? Thanks.
    Author, Jan 18, 2009
    #2
    1. Advertising

  3. Author

    George Guest

    Try to add following headers to your page

    Cache-Control: no-cache, no-store, max-age=0, must-revalidate
    Pragma: no-cache
    Expires: Fri, 01 Jan 1990 00:00:00 GMT

    Then when you click back button browser will request the page again and it's
    up to your code to check if user is not logged in and redirect to login
    page.

    George.

    "Author" <> wrote in message
    news:...
    > After we log out gmail, if we then click on the back button of our
    > browser, we cannot go back to our inbox. I've tried both Firefox and
    > IE, both work nicely like this. How did they achieve this?
    >
    > In my asp.net web application using forms authentication, one can
    > still go back through the browser back button after one logs out my
    > application, although, clicking on anything will still kick the user
    > out.
    >
    > How can I also prevent people from going back through the browser back
    > button after one has logged out, just like gmail?
    >
    > Thanks a lot.
    George, Jan 19, 2009
    #3
  4. Author

    Author Guest

    On Jan 18, 11:27 pm, "George" <> wrote:
    > Try to add following headers to your page
    >
    > Cache-Control: no-cache, no-store, max-age=0, must-revalidate
    > Pragma: no-cache
    > Expires: Fri, 01 Jan 1990 00:00:00 GMT
    >
    > Then when you click back button browser will request the page again and it's
    > up to your code to check if user is not logged in and redirect to login
    > page.
    >
    > George.
    >


    Thanks. I tried like what you said, but the problem is that it does
    not work, either in firefox or in IE. This is my html code (the
    relevant part only).

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
    <title>Untitled Page</title>
    <meta http-equiv="pragma" content="no-cache" />
    <meta http-equiv="Cache-Control" content="no-cache, no-store, max-
    age=0, must-revalidate" />
    <meta http-equiv="Expires" content="Fri, 01 Jan 1990 00:00:00
    GMT" />
    </head>
    <body>

    After I logout, I hit the back button of the browser, and it still
    goes back to the page and shows everything I have there, apparently
    from the cache and no post-back happens.

    No one really knows the gmail logout secret? Is it really a secret in
    the first place?
    Author, Jan 21, 2009
    #4
  5. Author

    George Guest

    When I said page headers I meant using
    Response.AddHeader and not meta tags.

    Sorry for confusion

    George.

    "Author" <> wrote in message
    news:...
    On Jan 18, 11:27 pm, "George" <> wrote:
    > Try to add following headers to your page
    >
    > Cache-Control: no-cache, no-store, max-age=0, must-revalidate
    > Pragma: no-cache
    > Expires: Fri, 01 Jan 1990 00:00:00 GMT
    >
    > Then when you click back button browser will request the page again and
    > it's
    > up to your code to check if user is not logged in and redirect to login
    > page.
    >
    > George.
    >


    Thanks. I tried like what you said, but the problem is that it does
    not work, either in firefox or in IE. This is my html code (the
    relevant part only).

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
    <title>Untitled Page</title>
    <meta http-equiv="pragma" content="no-cache" />
    <meta http-equiv="Cache-Control" content="no-cache, no-store, max-
    age=0, must-revalidate" />
    <meta http-equiv="Expires" content="Fri, 01 Jan 1990 00:00:00
    GMT" />
    </head>
    <body>

    After I logout, I hit the back button of the browser, and it still
    goes back to the page and shows everything I have there, apparently
    from the cache and no post-back happens.

    No one really knows the gmail logout secret? Is it really a secret in
    the first place?
    George, Jan 22, 2009
    #5
  6. Author

    Author Guest

    On Jan 21, 10:15 pm, "George" <> wrote:
    > When I said page headers I meant using
    > Response.AddHeader and not  meta tags.
    >
    > Sorry for confusion
    >
    > George.


    You rocked, George. Thanks a lot. It worked.
    Author, Jan 22, 2009
    #6
  7. Author

    George Guest

    Actually I would advice you to get 2 useful tools.

    1. Fiddler. It shows communication between server and IE.
    http://www.fiddlertool.com/fiddler/

    That is how I found out about headers Gmail sent.

    2. Firefox with FireBug.
    I can not thank developers of FireBug enough for such useful tool and wish
    IE had something close to that.
    Very useful if you doing a lot of JavaScript or AJAX.

    George.


    "Author" <> wrote in message
    news:...
    On Jan 21, 10:15 pm, "George" <> wrote:
    > When I said page headers I meant using
    > Response.AddHeader and not meta tags.
    >
    > Sorry for confusion
    >
    > George.


    You rocked, George. Thanks a lot. It worked.
    George, Jan 22, 2009
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Earl Teigrob
    Replies:
    0
    Views:
    550
    Earl Teigrob
    Dec 15, 2003
  2. Earl Teigrob
    Replies:
    1
    Views:
    1,255
    Earl Teigrob
    Dec 18, 2003
  3. Replies:
    0
    Views:
    294
  4. Frank
    Replies:
    0
    Views:
    458
    Frank
    Mar 20, 2007
  5. Replies:
    5
    Views:
    296
Loading...

Share This Page