Picture this: Your user is on a page and they want to select something that will force a change in a setting you have on your ASP objects, such as a variable in a COM object or whatever. Ignoring possible methods using cookies or go.back, this is one way it can be updated and put the user back on the page he was at with the QueryString data preserved. (As I said, there surely are other ways, but this one works and demonstrates how to pick up and recycle the QueryString data.)
Typically, GET/QueryString data is used to set up a page while POST/Form data is used for data submission. Since that's not always the case, you have to be sure that re-creating your GETs won't do something unwanted such as duplicating one-time writes or requests, etc.
Dim xPass, xPassTmp, in_PassItem, curQString
curQString = ""
in_PassItem = "0"
If session("ee_data") <> "" Then
If Request.ServerVariables("REQUEST_METHOD")="GET" Then
xPass = False ' flag for valid changes
' check for special server-side update
xPassTmp = Request.QueryString("serversidevar")
' this example will filter for valid entry request, such as a number 1 to 5
If varType(xPassTmp) = 8 and len(xPassTmp) = 1 Then
If inStr("12345",xPassTmp) > 0 Then
session("myObj").aspPassItem = xPassTmp
xPass = True
If xPass Then
' Redirection to this page again is done since a user selecting a page
' (not Pass case) might interfere with some pages which call themselves
' with and without passing URL variables.
' Only GET (QueryString) is resent, not POST (Form).
If len(request.QueryString("passqs")) > 0 Then
curQString = "?" & request.QueryString("passqs")
response.redirect "https://" & request.ServerVariables("server_name") & request.ServerVariables("URL") & curQString
' this next code executes only if this is a standard querystring entry
in_PassItem = session("myObj").aspPassItem
If len(request.ServerVariables("query_string")) > 0 Then
curQString = "&passqs=" & server.URLEncode(request.ServerVariables("query_string")) ' in case new setting selected
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<TITLE>Test: update server and return to QueryString page</TITLE>
<a id="RequestLink_1" href="<%=request.ServerVariables("URL")%>?serversidevar="1"<%=CurQString%>">Click here to change something on the server side</a></TD>