Post redirect get solution for the double submit prevention

prinaiday

New Member
I have a \[code\]register.aspx\[/code\] 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 \[code\]registration.aspx\[/code\] file:\[code\]<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>\[/code\]And here is the \[code\]registration.aspx.cs\[/code\] file:\[code\]protected void RegisterUser(object sender, EventArgs e){ if (txtUserName.Text.Length < 3) { lblErrorMessage.Text = "username should be minimum 3 characters, try again."; }}\[/code\]However, I try to test it using my browser, chrome. When I use the text "a" for the username, it goes into the \[code\]RegisterUser\[/code\] 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:
CzzAA.png
I tried using \[code\]Response.Redirect\[/code\] and it didn't work either.
 
Back
Top