Resend of data on refresh browser
how to prevent the resend of data to the db when user click on the refresh button of browser....
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
naura paxRank #2,843 · 502 reputationPosted Oct 27, 2009, 4:22 AM EDT
I know of a method where you can maintain a session variable to prevent db update on refresh.
Sub Page_Load (sender As Object, e As EventArgs) If Not Page.IsPostBack Session("update") = Server.URLEncode(System.DateTime.Now.ToString()) End If End Sub Sub Page_PreRender (sender As Object, e As EventArgs) ViewState("update") = Session("update") End Sub Sub Button1_Click(sender As Object, e As EventArgs) If Session("update").ToString() = ViewState("update").ToString() Then If AddEmployee(firstName.Text, lastName.Text) = 0 Message.Text = "Success" Session("update") = Server.URLEncode(System.DateTime.Now.ToString()) Else Message.Text = "Failure" End If Else Message.Text = "Failure - Session" End If firstName.Text = "" lastName.Text = "" End SubKirtan PatelRank #292 · 8.6K reputationPosted Oct 27, 2009, 4:26 AM EDT
after inserting data or Doin Any Procedure
just Redirect Page to Same page
ie ..
Response.Redirect("~/Default.aspx");
that Will not Show resend Data Now
please check "Do you like this answer" if it helps you :)
Lalit MRank #1,186 · 1.5K reputationPosted Jan 15, 2010, 8:47 PM EST
show this link
http://aspalliance.com/687_Preventing_Duplicate_Record_Insertion_on_Page_Refresh.all
http://forums.asp.net/p/1190997/2045619.aspx