Solved

erase query string without clientside redirect

Posted on 2004-04-23
5
533 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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/…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

747 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

10 Experts available now in Live!

Get 1:1 Help Now