Logging off an aspx page but I am to browse back to page

Discussion in 'ASP .Net' started by =?Utf-8?B?VGVycnk=?=, Oct 27, 2005.

  1. Hello everyone,
    I created a logon page using C# ASPX, I have the user logon and if logon
    information is correct I do a Response.Redirect(url); On the second page it
    displays data and I have a logoff button which does another
    Response.Redirect(main url); Here is the issue, I am able to browse back to
    that page and the data is still populated and visible. How can I clear the
    cache for that page? I have tried:

    Response.Expires = 0;
    Response.ExpiresAbsolute = DateTime.Now;
    Page.Response.Cache.SetCacheability(HttpCacheability.NoCache);

    And no such luck. I would appreciate the help.
    Thank you,
    Terry
     
    =?Utf-8?B?VGVycnk=?=, Oct 27, 2005
    #1
    1. Advertising

  2. Try using session variables.
    set a session variable saying the user is "authenticated" when the user
    logons.
    and on logoff, set that variable to say the user is not authenticated.
    and on the second page, right at the top, check that session variable to see
    if the user is authenticated or not.....if not...redirect the user back to
    logon page.


    "Terry" wrote:

    > Hello everyone,
    > I created a logon page using C# ASPX, I have the user logon and if logon
    > information is correct I do a Response.Redirect(url); On the second page it
    > displays data and I have a logoff button which does another
    > Response.Redirect(main url); Here is the issue, I am able to browse back to
    > that page and the data is still populated and visible. How can I clear the
    > cache for that page? I have tried:
    >
    > Response.Expires = 0;
    > Response.ExpiresAbsolute = DateTime.Now;
    > Page.Response.Cache.SetCacheability(HttpCacheability.NoCache);
    >
    > And no such luck. I would appreciate the help.
    > Thank you,
    > Terry
    >
     
    =?Utf-8?B?SmFzb24gQ2h1?=, Oct 27, 2005
    #2
    1. Advertising

  3. I have had a similar problem with a shopping cart checkout page. Once the
    user checks out you don't want them going back to this page.

    What I did was add this to the checkout page

    <head>
    <script language="javascript">
    history.forward();
    </script>
    </head>

    This gives the effect of a disabled the back button. So what happens is when
    the user leaves the checkout page and then tries to use the back button, they
    are redirected back to the page they are currently viewing... hence they can
    never use the back button to go back to the checkout page.

    You may be able to use a trick like this. Just add that code to the logon
    page and the user will never be able to go back to that page using the back
    button.

    Hope this helps.
    --
    Bill


    "Terry" wrote:

    > Hello everyone,
    > I created a logon page using C# ASPX, I have the user logon and if logon
    > information is correct I do a Response.Redirect(url); On the second page it
    > displays data and I have a logoff button which does another
    > Response.Redirect(main url); Here is the issue, I am able to browse back to
    > that page and the data is still populated and visible. How can I clear the
    > cache for that page? I have tried:
    >
    > Response.Expires = 0;
    > Response.ExpiresAbsolute = DateTime.Now;
    > Page.Response.Cache.SetCacheability(HttpCacheability.NoCache);
    >
    > And no such luck. I would appreciate the help.
    > Thank you,
    > Terry
    >
     
    =?Utf-8?B?QmlsbCBMb25n?=, Oct 27, 2005
    #3
    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.

Share This Page