Solved

erase query string without clientside redirect

Posted on 2004-04-23
5
542 Views
Last Modified: 2012-06-22
Hello experts,

I would like to perform a server-side action from an asp that would get rid of the query string or the form passed in before it returned the results to the client browser.  I know I can send javascript back to the browser that would perform the redirect, but I would prefer not to do that.

The reason for this is that I have the user submitting form information from page 1 via query string. This first action is accomplished via a javascript document.location.replace.  I then process the data in an asp, and return the results to the client browser (page 2).  The problem is that if the client user clicks the refresh button, the query data is still there, and gets re-submitted.

Any solutions would be most appreciated.
0
Comment
Question by:Codescripter
  • 3
  • 2
5 Comments
 
LVL 11

Accepted Solution

by:
Slimshaneey earned 500 total points
ID: 10901023
Response.redirect request.Servervariables("SCRIPT_Name") will redirect to the same page, minus the querystring.
0
 
LVL 11

Expert Comment

by:Slimshaneey
ID: 10901142
Actually your best bet I think, is to Submit not to page2 but to another page, pure asp page that does the insert then redirect to page 2.
I.e.
Page1 ->
posts to
AddToDB
This page does the addition in the DB
This page then redirects to Page 2 which displays conformation message that everytrhing went ok, or does a retreival from the DB of the data just inserted. Then user can refresh as often as nescessary cause the page isnt holding form data.
0
 
LVL 31

Expert Comment

by:alorentz
ID: 10901275
When you submit the information, set a session variable called session("submit"):

If session("submit") <> true then
'submit information
else
  Response.write "Information has already been submitted!"
end if
   session("submit") = true


That will prevent multiple submits...
0
 
LVL 11

Expert Comment

by:Slimshaneey
ID: 10901305
alorentz: Not always a viable option, what if someone genuinely enters 2 different records. The second one will not get inserted. To use that method you would have to wipe that session info each time page1 is loaded.
Ie
Session("Submit") = False
0
 
LVL 31

Expert Comment

by:alorentz
ID: 10901334
Of course you would need to set session("submit") = false....

The answer was to stop refresh resubmit problems.  When the form is accesed again, session("submit") would need to be set to false.

Maybe I should have wrote that, but was hoping he/she would get the point...
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now