Skip to content Skip to sidebar Skip to footer

How To Clear Browser History Oan Clear Cache?

I have a login page and a home page. Users can log in from the login page to the home page using a username and password. What I want to achieve is: 1) When user log out from home

Solution 1:

Use follwing code in OnPrerender() event of home page . It worked for me.

protectedoverridevoidOnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            string sb;
            sb = "<script language=javascript>\n";
            sb += "window.history.forward(1);\n";
            sb += "\n</script>";
            ClientScript.RegisterClientScriptBlock(Page.GetType(), "clientScript", sb);
        }

Solution 2:

How are you storing the login? if you are using session variables you could clear the session when user logs out and then on every page that you need to have the user logged in to view check to make sure that session variable exists in the page load, if it does then let the user continue and if not redirect to the login page (you could do this quickly by using a master page)

if you are using a cookie to store the log in then you could just expire the cookie when the user logs out

Solution 3:

when the user logins,keep his userid or whatever unique id the user has.And when he clicks logout unset the userid session..And add a few line in you page

<?php
session_start();
$_SESSION['uid']=$uid;
if($uid=='')
{
header("location:loginpage.php");
}
?>

It'll work.

Solution 4:

I have solution for You Please Find link below

Hope You will get your answer

stackoverflow

or

also find from this DotnetFundaa

On Page Load Put Code of below

    Response.Cache.SetCacheability(HttpCacheability.NoCache);
    Response.Cache.SetExpires(DateTime.Now);

Post a Comment for "How To Clear Browser History Oan Clear Cache?"