Solved

erase query string without clientside redirect

Posted on 2004-04-23
5
567 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
[X]
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
  • 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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

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…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

752 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