473,325 Members | 2,771 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

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 18119
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Dan | last post by:
We have a simple site. It's a frameset with two frames a left and a right. The left frame is essentially a list of records from a database (using a server-side repeater control). When you click...
3
by: Rob | last post by:
Each time a webform is posted back (submitted), another URL is added to the browser's history list. My web application allows a back button to return to previously visited pages, but I do not wish...
5
by: Jim Bayers | last post by:
I have a simple page, all that's on it is a datagrid. The datagrid is populated on page_load when it is bound to a datareader. The problem is: when a user refreshes the page, new records are...
4
by: D. Shane Fowlkes | last post by:
This may be a very simple question but I'm stumped none the less. I have a form where a user provides comments. There's a Grid below this form which displays all comments in the table so far. On...
1
by: achoo | last post by:
Is it possible to extend a Web service proxy so that it understands an HTTP refresh page? Explanation: * The Web service proxy was autogenerated by Visual Studio .NET 2003 from the Web...
10
by: phforum | last post by:
Hi, I wrote a PHP page for user input the information to search the database. And the database data will update every second. I want to set the auto refresh to get the data from database every...
1
by: Andy | last post by:
My application is written in .NET (C#) with the inline Edit mode from DataGrid. When a SAVE button is pressed it will perform a action on the database either to add, edit or delete data that a user...
3
by: =?Utf-8?B?Z296ZXI2MQ==?= | last post by:
Something happened to my development environment and I'm getting an error that hasn't happened before. Not knowing why the error is popping up is preventing me from figuring out what in my...
1
by: DaveRook | last post by:
Hi I am currently using a page redirect which is the wrong thing to do (I think). I am trying to be clever and work on a search algorythm (if that's the correct term). We have a series...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.