Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 10th, 2003, 07:38 AM
Authorized User
 
Join Date: Jul 2003
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to prevent submit back

Hi friends,

Here i've a problem in asp. When i am adding a record to database its adding it but when i refresh it its adding the same record again to databse. How to prevent adding record to database if user submits the page using refresh

Please help to overcome this problem

Thanking you in advance
__________________
B.V.Kumar
 
Old November 10th, 2003, 08:28 AM
Authorized User
 
Join Date: Jun 2003
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Take a look at this article:
http://www.4guysfromrolla.com/webtech/111500-1.shtml

Regards,

Gerhard Wentink
 
Old November 10th, 2003, 11:58 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

That is a handy article, but it doesn't address the underlying problem.

What I have done in the past is this:
Post your page to whatever page you wish to have handle the database update, but then on successful completion redirect to another page, or even to the same page, it doesn't matter. By redirecting, you are getting the browser away from a page that was posted to. You may need to "carry over" something, like a message indicating that the operation was completed, but this is much easier than trying to block all the different ways the user can go "back". They can refresh that "your record is updated" page over and over without affecting the actual db operation.

Peter
------------------------------------------------------
Work smarter, not harder.
 
Old November 11th, 2003, 01:21 AM
Authorized User
 
Join Date: Sep 2003
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to balakumar1000
Default

Why don't you remove the Proxy and browser cacheing of that page. So whenever the user refreshes, it won't retain its old state.

The page will be rendered newly. So you will not get your problem.


Balakumar Vijayan
Sr. S/W Engr.
Trivandrum





Similar Threads
Thread Thread Starter Forum Replies Last Post
Prevent users from using back button?? Phrozt C# 3 January 8th, 2007 11:02 AM
How to prevent Back History after Sing Out my site hatem ASP.NET 1.0 and 1.1 Basics 2 December 28th, 2006 02:55 AM
Prevent Submit Twice Joeboy General .NET 7 September 1st, 2004 10:12 AM
history.back or hitting the back button won't work lian_a Classic ASP Basics 4 July 29th, 2004 12:14 AM
submit to insert data and then click [BACK] vincentc Classic ASP Basics 0 September 9th, 2003 10:25 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.