By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
439,971 Members | 1,467 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 439,971 IT Pros & Developers. It's quick & easy.

How do I simply pass a simple variable??

P: n/a
I am simply trying to pass a variable to another page. I know my second
page can do Request("str") to retrieve that variable, but how do I pass it
in the first place?

I tried Server.Execute("P2.asp?str="hello") but I get errors.
I tried Response.Redirect("P2.asp?str="hello") but the variable is empty

I tried setting variables like you would in VB:
str="hello"
Server.Execute("P2.asp")
and hoping the second page would pick it up, but I don't know how to make
that str variable global.

I am not using forms, I am not using cookies, I was told not to use Session
or Application variables, it's a variable being passed just the first time a
page is accessed, after that links will send the variables.

How do you Set str="something" and then have the 2nd page pick it up?????
It shouldn't be that difficult!
Jul 19 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
eagletender wrote on 10 jul 2004 in
microsoft.public.inetserver.asp.general:
I know my second
page can do Request("str")
myStrP2 = Request.Querystring("str")
I tried Response.Redirect("P2.asp?str="hello") but the variable is empty


[if we are using vbscript:]

Response.Redirect "P2.asp?str=hello"

or

myStrP1 = "hello"
Response.Redirect "P2.asp?str=" & myStrP1

================

I would prefer a session variable to get this pure serverside content from
one page to another.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #2

P: n/a
Response.redirect "?err=something_else"

<%
something = request.querystring("err")
response.write something
%>

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
"eagletender" <ea*************@yahoo.com> wrote in message
news:10*************@corp.supernews.com...
I am simply trying to pass a variable to another page. I know my second
page can do Request("str") to retrieve that variable, but how do I pass it
in the first place?

I tried Server.Execute("P2.asp?str="hello") but I get errors.
I tried Response.Redirect("P2.asp?str="hello") but the variable is empty

I tried setting variables like you would in VB:
str="hello"
Server.Execute("P2.asp")
and hoping the second page would pick it up, but I don't know how to make
that str variable global.

I am not using forms, I am not using cookies, I was told not to use Session or Application variables, it's a variable being passed just the first time a page is accessed, after that links will send the variables.

How do you Set str="something" and then have the 2nd page pick it up?????
It shouldn't be that difficult!

Jul 19 '05 #3

P: n/a
On Sat, 10 Jul 2004 11:02:34 -0600, "eagletender"
<ea*************@yahoo.com> wrote:
I am simply trying to pass a variable to another page. I know my second
page can do Request("str") to retrieve that variable, but how do I pass it
in the first place?

I tried Server.Execute("P2.asp?str="hello") but I get errors.
Yep. See:

http://www.aspfaq.com/show.asp?id=2030
I tried Response.Redirect("P2.asp?str="hello") but the variable is empty
Yep.
I tried setting variables like you would in VB:
str="hello"
Server.Execute("P2.asp")
and hoping the second page would pick it up, but I don't know how to make
that str variable global.
Can't.
I am not using forms, I am not using cookies, I was told not to use Session
or Application variables, it's a variable being passed just the first time a
page is accessed, after that links will send the variables.
Forms, sessions and cookies would all do what you wish.
How do you Set str="something" and then have the 2nd page pick it up?????
It shouldn't be that difficult!


Request.Querystring:

http://www.devguru.com/Technologies/...erystring.html

Jeff
Jul 19 '05 #4

P: n/a
Have you tried using a session variable?

Jeff Cochran wrote:
On Sat, 10 Jul 2004 11:02:34 -0600, "eagletender"
<ea*************@yahoo.com> wrote:

I am simply trying to pass a variable to another page. I know my second
page can do Request("str") to retrieve that variable, but how do I pass it
in the first place?

I tried Server.Execute("P2.asp?str="hello") but I get errors.

Yep. See:

http://www.aspfaq.com/show.asp?id=2030

I tried Response.Redirect("P2.asp?str="hello") but the variable is empty

Yep.

I tried setting variables like you would in VB:
str="hello"
Server.Execute("P2.asp")
and hoping the second page would pick it up, but I don't know how to make
that str variable global.

Can't.

I am not using forms, I am not using cookies, I was told not to use Session
or Application variables, it's a variable being passed just the first time a
page is accessed, after that links will send the variables.

Forms, sessions and cookies would all do what you wish.

How do you Set str="something" and then have the 2nd page pick it up?????
It shouldn't be that difficult!

Request.Querystring:

http://www.devguru.com/Technologies/...erystring.html

Jeff


Jul 19 '05 #5

P: n/a
Buddy you are using quoted identifiers in the wrong way

Try this

1.
Server.Execute("P2.asp?str='hello'")
Response.Redirect("P2.asp?str='hello'")

2.
Server.Execute("P2.asp?str=hello&Variable2=whateve r you want goes here")
Response.Redirect("P2.asp?str=The string here can contain spaces")

And to access any of the vairables just do this

x = Request.QueryString("str")
Response.Write(x) ' do anything withthe variable
Jul 19 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.