MSDOTnet.org Forum Index
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Prevent ASP.NET page to resend data on refresh?

 
Post new topic   Reply to topic    MSDOTnet.org Forum Index -> ASPNet
Author Message
Asaf



Joined: 08 Aug 2007
Posts: 10

PostPosted: Wed Dec 12, 2007 9:44 am    Post subject: Prevent ASP.NET page to resend data on refresh? Reply with quote

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

Archived from group: microsoft>public>dotnet>framework>aspnet
Back to top
View user's profile Send private message
Peter Bromberg [C# MVP]



Joined: 31 Oct 2007
Posts: 22

PostPosted: Wed Dec 12, 2007 9:50 am    Post subject: RE: Prevent ASP.NET page to resend data on refresh? Reply with quote

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
>
Back to top
View user's profile Send private message
Larry Bud



Joined: 08 Aug 2007
Posts: 1

PostPosted: Wed Dec 12, 2007 10:25 am    Post subject: Re: Prevent ASP.NET page to resend data on refresh? Reply with quote

On Dec 12, 7:44 am, 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?

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.
Back to top
View user's profile Send private message
Asaf



Joined: 08 Aug 2007
Posts: 10

PostPosted: Wed Dec 12, 2007 1:31 pm    Post subject: RE: Prevent ASP.NET page to resend data on refresh? Reply with quote

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
> >
Back to top
View user's profile Send private message
Steven Cheng[MSFT]



Joined: 08 Aug 2007
Posts: 196

PostPosted: Thu Dec 13, 2007 7:57 am    Post subject: RE: Prevent ASP.NET page to resend data on refresh? Reply with quote

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==?=
>References:

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

Back to top
View user's profile Send private message
Display posts from previous:   
Related Topics:
Viewstate and preserving data on postbacks hi, I just want simply to preserve some data in my usercontrol on postbacks. so I added this property in my UserControl Protected Property MyProperty() As String Get If Not Is Nothing Then Return Else Return "" End If End

How to prevent annoying page caching between rebuilds? Why every time I make a change to a WEB page, rebuild and run the application, my changes do not appear? The only way to see my changes is to refresh the page from the browser Any ideas?

Refresh frameset and selective refresh of frame/s I have an asp.net app., with a few webforms. In a button click event on a page) I have code to update a particular file, restart the loading and saving the web.config file). Then to refresh the current page and come back

Passing data in ASP.NET from a multi-threaded page I have a question concerning passing large amounts of data once a background thread is complete, such as report data embedded in an XMLDoc, to a receiving page (rather than use a session var, which is expensive.) I've tried the standard technique of refe

Maintaining session and auth. ticket from page to page redir Hi, I'm hoping that someone can clear some of my confusion as I cannot seem to find a complete answer on the subject. I'm using VS.NET 2003 and creating an ASP.NET mobile application. I'm using Forms to authenticate the user. Now, I'm assum
Post new topic   Reply to topic    MSDOTnet.org Forum Index -> ASPNet All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group