It is a common question for developer how to to prevent user’s from going to previous page using Browser Back button.
You can do it in various way:
Javascript Codesnippet1:
<script type = "text/javascript" >
function disableBackButton()
{window.history.forward();
}
setTimeout("disableBackButton()", 0);
</script>
For internet explorer: <body onload="disableBackButton()">
If you are using firefox then use <body onunload="disableBackButton()"> instead of onload.
For Server side:
C#-> Asp.net 2.0
ASP.NET 2.0 (there is a new HttpCachePolicy class) :
/*
* Code disables caching by browser. Hence hitting the back browser button
* causes the Page_Load event to fire again.
*/
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetExpires(DateTime.Now); //or a date much earlier than current time
Sharing real-world experiences about C#, Dynamics CRM, Dynamics 365, Dynamics NAV/Business Central, SharePoint,PowerBI,ASP.net and more...
Subscribe to:
Post Comments (Atom)
Method 'StartWorkflowOnListItem' in type 'Microsoft.SharePoint.WorkflowServices.FabricWorkflowInstanceProvider'
Exception: Method 'StartWorkflowOnListItem' in type 'Microsoft.SharePoint.WorkflowServices.FabricWorkflowInstanceProvider'...
-
The CheckBoxList control in ASP.NET 2.0 is one of the useful control for asp.net developer. But it is not so easy(also not complicated :))to...
-
There are various ways to use Single Sign on(SSO) in asp.net web application. We can use cookies, session (state server), SAML and web serv...
-
Problem: Today I have faced a new problem(new for me), when I press save button it works fine and then refresh(F5 or Refresh button on brow...
No comments:
Post a Comment