Prevent ASP.NET page to resend data on refresh?

A

Asaf

Hi,

How can I prevent from an ASP.NET page to resend all the data again when the
user press the Refresh button or F5 on the browser?

Thanks in advanced,
Asaf
 
L

Larry Bud

Hi,

How can I prevent from an ASP.NET page to resend all the data again when the
user press the Refresh button or F5 on the browser?

Do a response.redirect after your data is handled to the same page.

For example, if you're letting the databind do all the work, do a
response.direct on a datasource inserted (or updated) event.

If you're handling the data manipulation in code, do it after you do
all your work.
 
A

Asaf

Hi Peter,

I misunderstood your solution, will be much appreciated if you can post an
example.

Asaf
 
S

Steven Cheng[MSFT]

Hi Asaf,

For prevent duplicate form submitting, there does exists some session flag
based approach, here are some web thread discussing on this:

#Preventing Duplicate Record Insertion on Page Refresh
http://aspalliance.com/687

#Prevent Duplicate Form Posting
http://forums.asp.net/p/447620/471229.aspx#471229

http://forums.asp.net/p/1190997/2045619.aspx

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
From: =?Utf-8?B?QXNhZg==?= <[email protected]>
References: <[email protected]>
 
E

elizas

One of most common issue which many of the web developers face in their web
applications, is that the duplicate records are inserted to the Database on
page refresh. If the web page contains some text box and a button to submit
the textbox data to the database. In that case when the user insert some data
to the textbox and click on the submit button, it will save the record to the
Database and then if the user refresh the web page immediately then the same
record is again saved to the database as there is no unique keys that can be
used to verify the existence of the data, so as to prevent the multiple
insertion.

http://www.mindfiresolutions.com/Avoid-Duplicate-record-insertion-on-page-refresh-in-ASPNET-486.php
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top