How can I save the variable value in Request.QueryString

liunx

Guest
If other people request my ASP page with some parameters like <!-- m --><a class="postlink" href="http://xxxxx.asp?v1=a&v2=b">http://xxxxx.asp?v1=a&v2=b</a><!-- m -->

How can I save the value of v1 and v2 in local variables for later use? Seems like I can print them out using Response.wrtie() but can not save them. Does anybody know?Dim var1, var2
var1 = Request.QueryString("v1")
var2 = Request.QueryString("v1")
..


Within the current ASP page you can always refer to the variables with Request("varname"), so you don't really need to save them..

If you're trying to forward the variables onto another page, you should send them over using forms, or a global variable, or possibly with Session objects.I define the global variables at the beginning of the page that contains the frameset and want to send value to pages inside the frame, but when i set variable=Request.QueryString("v1") and print it out later, is says the variable is undefined or just has the initial value instead of the one in requestAre you sure the values are being passed to the frameset page itself?

And when you print do you refer to the global variable and not the Request variable?I think I do, like "alert(global)"

but is says undefinedHow are you defining the global variables?

An article i found shows the same problem you had due to the variable declaration.

Try declaring the variable first, and then setting it
<script type='text/javascript'>
var x;
x = '<%=globalvar%>';
alert(x);
</script>

<!-- m --><a class="postlink" href="http://forums.devshed.com/archive/t-187655I">http://forums.devshed.com/archive/t-187655I</a><!-- m --> think the problem happens when I set Request.QueryString() to variable, coz if I set a static value to variable then it can be printed out in another pagetry printing out the querystring variable and see what you get...If I use response.write(request.querystring("v1")) I can get the right value, but just can not set it to a variable, I don't know whyCan we see some code?This page is the page containing the frameset and I want to get the value from querystring and then pass it the pages inside the frames.

I want to put value into "initialWMS" and "initialLayer"

Thanks
 
Back
Top