Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

erase query string without clientside redirect

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
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…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

792 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