When I click a button in the result form ,then Response.End() will be called. But from that form (End) I can go back to result form.
what is form(End)? What is the relationship between him and the result form?
shsu
How can I prevent user to click back arrow(windows) of the response. End form
Do you want to disable the goback button on the page? If so, you can try below code.
The preventBack() method disable the goback button.
<script type="text/javascript">
function preventBack() { window.history.forward(); }
setTimeout("preventBack()", 0);
window.onunload = function () { null };
</script>
<form id="form1" runat="server">
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
</form>
protected void Button1_Click(object sender, EventArgs e)
{
Response.Write("This is the refreshed page");
}
The result:
Best regards,
Sam
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
This is a new question, please post your question in new thread.
Best regards,
sam
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
Member
183 Points
401 Posts
Response.End()
Oct 30, 2019 03:41 AM|shsu|LINK
Response.End()
When I click a button in the result form ,then Response.End() will be called. But from that form (End) I can go back to result form.
How can I prevent user to click back arrow(windows) of the response. End form
Thanks
Contributor
3370 Points
1409 Posts
Re: Response.End()
Oct 30, 2019 07:03 AM|samwu|LINK
Hi shsu,
what is form(End)? What is the relationship between him and the result form?
Do you want to disable the goback button on the page? If so, you can try below code.
The preventBack() method disable the goback button.
<script type="text/javascript"> function preventBack() { window.history.forward(); } setTimeout("preventBack()", 0); window.onunload = function () { null }; </script> <form id="form1" runat="server"> <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" /> </form> protected void Button1_Click(object sender, EventArgs e) { Response.Write("This is the refreshed page"); }
The result:
Best regards,
Sam
Contributor
2096 Points
1040 Posts
Re: Response.End()
Oct 30, 2019 10:33 AM|Khuram.Shahzad|LINK
There are 4 solutions describe here
https://lennilobel.wordpress.com/2009/07/26/defeat-the-evil-back-button-in-your-asp-net-applications/
For Server Side:
Member
183 Points
401 Posts
Re: Response.End()
Oct 31, 2019 02:22 AM|shsu|LINK
Thanks, If I want to show a message in the Response.end form then how can I do that?
Contributor
3370 Points
1409 Posts
Re: Response.End()
Oct 31, 2019 09:20 AM|samwu|LINK
Hi shsu,
This is a new question, please post your question in new thread.
Best regards,
sam