Link to home
Start Free TrialLog in
Avatar of Codescripter
Codescripter

asked on

erase query string without clientside redirect

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.
ASKER CERTIFIED SOLUTION
Avatar of Slimshaneey
Slimshaneey
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
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...
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
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...