469,904 Members | 2,383 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,904 developers. It's quick & easy.

Prevent ASP.NET page to resend data on refresh?

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

Dec 12 '07 #1
4 17896
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
Dec 12 '07 #2
On Dec 12, 7:44 am, Asaf <A...@newsgroups.nospamwrote:
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.

Dec 12 '07 #3
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
Dec 12 '07 #4
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==?= <AG**@newsgroups.nospam>
References: <AA**********************************@microsoft.co m>
<D0**********************************@microsoft.co m>
>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
Dec 13 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Jim Bayers | last post: by
4 posts views Thread by D. Shane Fowlkes | last post: by
3 posts views Thread by =?Utf-8?B?Z296ZXI2MQ==?= | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.