Home > ASP Development > Passing variable in request.querystring

Passing variable in request.querystring



I have set a variable on a page called varUser(Set from cookie) I am trying to pass this through to the next page and am having diffuculties with something that should be simple. I already tried session variable but had some hiccups with it.



Any suggestions would be welcomed



Here is the code that sets the variable




Code:


<%
DIM varUser
varUser = Request.Cookies("com_jdedwards_LastLayout")
%>



    
Guest


Quote:
Originally Posted by misterzr
I have set a variable on a page called varUser(Set from cookie) I am trying to pass this through to the next page and am having diffuculties with something that should be simple. I already tried session variable but had some hiccups with it.



Any suggestions would be welcomed



Here is the code that sets the variable




Code:


<%
DIM varUser
varUser = Request.Cookies("com_jdedwards_LastLayout")
%>






could you explain a little more on what you are trying to do? if you had set a cookie value then you can request on ANY other page with Request.Cookies method (the purpose of a cookie)

Was this answer helpful ? Yes No   
Guest


You can pass variables to another page by posting a form, with a object (textfield) or you can put the value into the querystring of a link.



If you just need the value on the next page I would create a hidden textfield or session variable.

Was this answer helpful ? Yes No   
Guest


I am passing the cookie value to another domain, this is the reason I can't just call the cookie from that page.

Was this answer helpful ? Yes No   
Guest


Quote:
Originally Posted by misterzr
I am passing the cookie value to another domain, this is the reason I can't just call the cookie from that page.








ok, i read the above wrong...what do you mean you are passing the cookie to another domain? the cookie is set on the client.

Was this answer helpful ? Yes No   
Guest


Quote:
Originally Posted by misterzr
I am passing the cookie value to another domain, this is the reason I can't just call the cookie from that page.




Please post your code on the domain querystring.

Was this answer helpful ? Yes No   
Guest


This is how I am trying to read it from next page

Code:


<%
DIM userWrite
userWrite = Request.querystring("username")
%>






This is how I was trying to send it (unsuccessfully)




Code:


<a href="cookie_read_test.asp?username="+varUser+>CLICK HERE </a>



Was this answer helpful ? Yes No   
Guest



Code:


<a href="cookie_read_test.asp?username="+varUser+>CLICK HERE </a>




Should be:




Code:


<% Response.write("<a href="cookie_read_test.asp?username=" & varUser & ">CLICK HERE</a>")



Was this answer helpful ? Yes No   
Guest


Quote:
Originally Posted by Calldean

Code:


<a href="cookie_read_test.asp?username="+varUser+>CLICK HERE </a>




Should be:




Code:


<% Response.write("<a href="cookie_read_test.asp?username=" & varUser & ">CLICK HERE</a>")






Calldean called it right but i thought you

said it was going to another domain

now i'm



If your just passing it onto another page then why bother with the querysrting just use request.cookies("yourcookiename")

as bslintx originally suggested.

Was this answer helpful ? Yes No   
Guest


Quote:
Originally Posted by misterzr
This is how I am trying to read it from next page

Code:


<%
DIM userWrite
userWrite = Request.querystring("username")
%>






This is how I was trying to send it (unsuccessfully)




Code:


<a href="cookie_read_test.asp?username="+varUser+>CLICK HERE </a>








you could use the response.write "shortcut"




Code:



<a href="cookie_read_test.asp?username=<%=varUser%>">CLICK HERE </a>



Was this answer helpful ? Yes No   
Guest
 
 
Home - About Infoqu - Contact - Privacy Statement - Link to Infoqu - Bookmark Infoqu

Copyright 2007-2008 by Infoqu. All rights reserved