Home
|
Software
|
WebLog
|
Contact
|
Wish List
navigation
software
RxFind - Search/Replace
.net DatabaseUtility lib.
GAlert - Gmail Notify
code, scripts, etc...
Akismet .Net 2.0 API
Price vs Cost
WebLogs / Blog
Page Comments
Cookie Detection
Refresh Detection
Global Error Handler
Easy HTTP .Net
California Lottery
ASP.NET HTML Template
Bookmarklets
tech articles
Extend ASP 2.0 security
Safe Web Surfing
toys and gadgets
T-Mobile Sidekick II
Sony DirecTiVo
GT I-Drive 6.0 (bike)
Bit Char-G (R/C car)
SolarSpeeder
Canon PowerShot s200
active projects
WebLogs
PageComments
WasArrested.com
mygurus.net
Refresh Detection (Asp.NET)
Download binary project - 9 Kb
Download source project - 11 Kb
Overview
Many websites suffer from the form browser refresh problem. For example, let's say you have a shopping cart. After the user buys item X, the page displays an invoice. The user refreshes the page, which asks if he'd like to repost the form. The user clicks "Retry" and the form is submitted again, charging his credit card and adding a duplicate order.
To fix this problem I have created a control (inspired by Dino Esposito's browser refresh detection code) that can be simply slipped into every page that may suffer from the form repost problem.
If you found this or any other code on this site usefull and want to show your appreciation, now you can. Thanks!
Example
Below is an example; a button that posts a form. (Most forms have text box fields, but for this example they are not necessary and have been omitted).
Page Status:
This page has
NOT
been refreshed.
Button Status:
This button has been clicked
0 times
.
Click the button and press your browsers refresh button to test the refresh detection.
My
contact form
now detects browser refresh to eliminate multiple submissions. Please feel free to test it out and send me an email :)
Visual Studio Toolbox Installation
Add the control to your toolbox. Go to Tools > Customize Toolbox. Click the tab .Net Framework Components. Click on Browse, locate Joel.Net.Refresh.dll and click ok. You should now see "Refresh" in the toolbox.
post reply to this comment
Comment by
Luis Lazcano
[Jan 07, 2008 @ 11:24 PM]
Hey, i have been working to solve shopping cart issues in a new .NET development and yours is the only simple solution, maybe i made mistakes when trying to implement other solutions (like Dino Esposito among them) but i worked hard and couldn't make them work Until i stumbled with this page. Thank you so much.
read replies to this comment
post reply to this comment
Comment by
Ed Hinton
[Jan 23, 2008 @ 6:29 PM]
Unfortunately, thius control seems to suffer from the same problem all the other solutions I've found does. It doesn't work if the URL is being displayed within an iframe of another page. For some reason, the first time the button is clicked, it increments the counter. After that, clicking the button acts as if it is the browser refresh. Any ideas on how to get it to work even if the page is displayed within an iframe? In my app, I have to embed it in an iframe of an app I do not have source code for, so I need a solution that works by itself even when embedded in an iframe.
Thanks for any ideas on this.
read replies to this comment
Leave Your Comment
Name:
Email:
(gravatar enabled)
URL:
Comment:
or
Cancel
Leave a Comment