Disable Browser Back Button Functionality Using Pagebehind(C#)

Explanation:

 

Say you are in page A and from page ‘A’ you are redirecting to page ‘B’. Once you are in page ‘B’ you don’t want to comeback in page ‘A’ using browser back button option. All you need to add the following code in page ‘A’ to implement this idea.

 

protected override void OnPreRender(EventArgs e)

{

        base.OnPreRender(e);

        string sb;

        sb = "<script language=javascript>\n";

        sb += "window.history.forward(1);\n";

        sb += "\n</script>";

        Page.RegisterClientScriptBlock("clientScript", sb);

 }