I have a register.aspx which takes some information from user and stores it in the database. However, I cannot solve the double submit problem when user refreshes the page. Here is my registration.aspx file:
<form id="form1" runat="server">
<asp:TextBox ID="txtUserName" runat="server"></asp:TextBox>
<asp:Button ID="btnRegister" runat="server" Text="Button" onclick="RegisterUser" />
<asp:Label ID="lblErrorMessage" runat="server" Text=""></asp:Label>
</form>
And here is the registration.aspx.cs file:
protected void RegisterUser(object sender, EventArgs e)
{
if (txtUserName.Text.Length < 3)
{
lblErrorMessage.Text = "username should be minimum 3 characters, try again.";
}
}
However, I try to test it using my browser, chrome. When I use the text "a" for the username, it goes into the RegisterUser function and shows the error message. But sadly, when I try to refresh the page it asks for resubmission while I was expecting to refresh without any problem:

I tried using Response.Redirect and it didn't work either.