Hi this is siddu
I want to stop the auto refresh when there
is key press and mouse click event in Asp..net withj C#
i used link
http://stackoverflow.com/questions/4644027/how-to-automatically-reload-a-page-after-a-given-period-of-inactivity
but not work for me pleasem let us know
The solution
<head>
<meta http-equiv="refresh" content="60" />
<script type="text/javascript">
var time = new Date().getTime();
$(document.body).bind("mousemove keypress", function (e) {
time = new Date().getTime();
});
function refresh() {
if (new Date().getTime() - time >= 60000)
window.location.reload(true);
else
setTimeout(refresh, 10000);
}
setTimeout(refresh, 10000);
</script>
</head>
if (Session["user"] != null && Session["test"] != null)
{
// let them access the page.
Label1.Text = "Welcome " + Session["test"].ToString();
}
else
{
//clear the cache and redirect back to login page.
Response.Cache.SetExpires(DateTime.UtcNow.AddMinutes(-1));
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetNoStore();
Session.Abandon();
Response.Redirect("Default.aspx");
}