Logout and Back Button Problem

Last post 05-27-2009 9:49 AM by imran_amodi. 6 replies.

Sort Posts:

  • Logout and Back Button Problem

    05-14-2009, 4:15 AM
    • Member
      51 point Member
    • imran_amodi
    • Member since 05-10-2008, 3:40 PM
    • Posts 106
    Hello friends,

                               I have some web froms (.aspx) in a folder called “Secure” and a web.config at the application root and the login.aspx.  Everything works fine, when I logout it is redirected to Login.aspx, but when I click back on the browser I can view the secured pages (this should not happen as I am already logout). How to get rid of this problem???

    Web.config file at the application root:

    <authentication mode="Forms">

          <forms loginUrl="login.aspx" slidingExpiration="true" timeout="2"/>

    </authentication>

    <authorization>

          <deny users="?"/>

    </authorization>

    Sign-Out button code:

    FormsAuthentication.SignOut();

    FormsAuthentication.RedirectToLoginPage();

  • Re: Logout and Back Button Problem

    05-14-2009, 4:30 AM
    • Contributor
      3,573 point Contributor
    • shawpnendu
    • Member since 02-17-2008, 1:34 AM
    • Dhaka
    • Posts 628

    HI,
    IN MY BELOW POST HERE I SHOWED HOW YOU CAN DISABLE BROWSER BACK BUTTON.
    http://shawpnendu.blogspot.com/2009/04/cross-browser-javascript-to-disable.html

    HOPE IT WILL HELP YOU.

    MARK AS ANSWER if its help you.

    Shawpnendu Bikash Maloroy
    MCTS
    http://shawpnendu.blogspot.com
  • Re: Logout and Back Button Problem

    05-16-2009, 8:59 AM
    • Member
      51 point Member
    • imran_amodi
    • Member since 05-10-2008, 3:40 PM
    • Posts 106

     Thanks Shawpnendu for your reply.

                                                         But its not working for me. Any other tips or references.???

                                  

  • Re: Logout and Back Button Problem

    05-18-2009, 3:30 AM
    Answer

    Hi imran_amodi,

    The problem is caused by the cache in client. To disable the client cache, please check this post.

    Thanks.

    David Qian
    Microsoft Online Community Support

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
  • Re: Logout and Back Button Problem

    05-23-2009, 11:31 AM
    • Member
      51 point Member
    • imran_amodi
    • Member since 05-10-2008, 3:40 PM
    • Posts 106

     Thanks Wencui Qian,

                                       Sorry for late reply i was on leave.

  • Re: Logout and Back Button Problem

    05-23-2009, 11:51 AM
    Answer
    • Star
      10,646 point Star
    • sumitd
    • Member since 07-16-2008, 4:32 PM
    • Bangalore
    • Posts 1,874

    Try this:

    Response.Cache.SetExpires(DateTime.UtcNow.AddMinutes(-1));
    Response.Cache.SetCacheability(HttpCacheability.NoCache);
    Response.Cache.SetNoStore();

    When ever back button will be clicked, it won't show the page as the page whon't be cached.

    Refer below url to know more about the caching:

    http://msdn.microsoft.com/en-us/library/w9s3a17d(VS.71).aspx

    http://msdn.microsoft.com/en-us/kb/kb00323290.aspx

    http://msdn.microsoft.com/en-us/library/hdxfb6cy.aspx

    Please mark it as answer if it resolves the issue.

    visit: http://technicalsol.blogspot.com

    Latest ajax control toolkit (Release: May 13, 2009): http://ajaxcontroltoolkit.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=27326
  • Re: Logout and Back Button Problem

    05-27-2009, 9:49 AM
    • Member
      51 point Member
    • imran_amodi
    • Member since 05-10-2008, 3:40 PM
    • Posts 106

     Thanks Sumitd.

Page 1 of 1 (7 items)