Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Prevent ASP.NET page to resend data on refresh?

Reply
Thread Tools

Prevent ASP.NET page to resend data on refresh?

 
 
Asaf
Guest
Posts: n/a
 
      12-12-2007
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

 
Reply With Quote
 
 
 
 
Peter Bromberg [C# MVP]
Guest
Posts: n/a
 
      12-12-2007
One easy way to handle this is to set a Session variable the first time the
page is posted. You can check for the presence of this on any refresh and
abort resending.
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
MetaFinder: http://www.blogmetafinder.com


"Asaf" wrote:

> 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
>

 
Reply With Quote
 
 
 
 
Larry Bud
Guest
Posts: n/a
 
      12-12-2007
On Dec 12, 7:44 am, Asaf <(E-Mail Removed)> wrote:
> 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.

 
Reply With Quote
 
Asaf
Guest
Posts: n/a
 
      12-12-2007
Hi Peter,

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

Asaf

"Peter Bromberg [C# MVP]" wrote:

> One easy way to handle this is to set a Session variable the first time the
> page is posted. You can check for the presence of this on any refresh and
> abort resending.
> -- Peter
> Site: http://www.eggheadcafe.com
> UnBlog: http://petesbloggerama.blogspot.com
> MetaFinder: http://www.blogmetafinder.com
>
>
> "Asaf" wrote:
>
> > 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
> >

 
Reply With Quote
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      12-13-2007
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==?= <(E-Mail Removed)>
>References: <(E-Mail Removed)>

<(E-Mail Removed)>
>Subject: RE: Prevent ASP.NET page to resend data on refresh?
>Date: Wed, 12 Dec 2007 08:31:03 -0800
>
>Hi Peter,
>
>I misunderstood your solution, will be much appreciated if you can post an
>example.
>
>Asaf
>
>"Peter Bromberg [C# MVP]" wrote:
>
>> One easy way to handle this is to set a Session variable the first time

the
>> page is posted. You can check for the presence of this on any refresh

and
>> abort resending.
>> -- Peter
>> Site: http://www.eggheadcafe.com
>> UnBlog: http://petesbloggerama.blogspot.com
>> MetaFinder: http://www.blogmetafinder.com
>>
>>
>> "Asaf" wrote:
>>
>> > 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
>> >

>


 
Reply With Quote
 
elizas
Guest
Posts: n/a
 
      02-15-2010
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/Avo...ASPNET-486.php
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[RESEND] Need to remove blank XMLNS attribute from xmldocument =?Utf-8?B?RXdhbiBGYWlyd2VhdGhlcg==?= ASP .Net 1 04-18-2006 01:39 PM
Resend: weird network traffic when accessing server over wireless connection Xavier Wireless Networking 0 03-26-2006 09:52 PM
resend a message widjay Java 0 04-04-2005 08:29 PM
Resend, Anyone??? PDM ignore following Command Simon Koh Cisco 5 10-14-2004 07:41 PM
[JavaMail] resend the message using a different SMTP server? mrby Java 6 05-06-2004 05:06 PM



Advertisments