Calling ASP variable to another ASP file

A

Avi

I have two asp files. I would like to call a variable from one of the
asp files to another one.

first.asp file activated it has the following variables that I want
called by other files.
demoName="Test demo"
salesPersonEmail="first.last"
specificURL="testURL"

The other asp file should be able to call on this information, and then
place it in various areas.

Thanks,

Avi
 
E

Evertjan.

Avi wrote on 02 nov 2005 in microsoft.public.inetserver.asp.general:
I have two asp files. I would like to call a variable from one of the
asp files to another one.

first.asp file activated it has the following variables that I want
called by other files.
demoName="Test demo"
salesPersonEmail="first.last"
specificURL="testURL"

The other asp file should be able to call on this information, and then
place it in various areas.

Use session variables

<%
session("demoName")="Test demo"
%>

and in the next page:

<%
demoName = session("demoName")
%>

demoName is: <%=demoName %>
 
A

Avi

Hello.
Thanks for the help, but this did not work for me. Maybe I need to
explain more.

I have an asp file (begin.asp). I want to put something similar to the
following in it:
demoName="Test demo"
salesPersonEmail="first.last"
specificURL="testURL"

The form will then redirect the user to one of two pages (if it is a
first time user then it goes to one page, if it is a returning user it
goes to a different page). This is handled by a cookie.
I want the pages the user gets sent to to retreive the above
information so it could be utilized.

Thanks,

Avi
 
E

Evertjan.

Avi wrote on 02 nov 2005 in microsoft.public.inetserver.asp.general:
Thanks for the help, but this did not work for me. Maybe I need to
explain more.

If you do not quote onn usenet, others cannot follow you, so please quote
where you are responding on.

Start by telling what you mean by "did not work for me"

I have an asp file (begin.asp). I want to put something similar to the
following in it:
demoName="Test demo"
salesPersonEmail="first.last"
specificURL="testURL"

The form will then redirect the user to one of two pages (if it is a
first time user then it goes to one page, if it is a returning user it
goes to a different page). This is handled by a cookie.
I want the pages the user gets sent to to retreive the above
information so it could be utilized.

I seem vaguely to remember I advised session variables.
Why wouldn't they "work"?
 
R

Roland Hall

in message
: Hello.
: Thanks for the help, but this did not work for me. Maybe I need to
: explain more.

No offense but you need to listen more. Evertjan is telling you how to
store the value of a variable and easily retrieve it on another page. If
you're not familiar with session variables, then say so. It makes it easier
to help you. "did not work for me" tells us nothing specific. We depend on
you to draw us a picture and all we're seeing is you have a blank page.

: I have an asp file (begin.asp). I want to put something similar to the
: following in it:
: demoName="Test demo"
: salesPersonEmail="first.last"
: specificURL="testURL"

session("demoName") = "Test demo"
session("salesPersonEmail") = "first.last"
session("specificURL") = "testURL"

: The form will then redirect the user to one of two pages (if it is a
: first time user then it goes to one page, if it is a returning user it
: goes to a different page). This is handled by a cookie.
: I want the pages the user gets sent to to retreive the above
: information so it could be utilized.

page1.asp/page2.asp

..
..
..
dim demoName, salesPersonEmail, specificURL
demoName = session("demoName")
salesPersonEmail = session("salesPersonEmail")
specificURL = session("specificURL")
..
..
..
--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
 
A

Avi

Roland said:
in message
: Hello.
: Thanks for the help, but this did not work for me. Maybe I need to
: explain more.

No offense but you need to listen more. Evertjan is telling you how to
store the value of a variable and easily retrieve it on another page. If
you're not familiar with session variables, then say so. It makes it easier
to help you. "did not work for me" tells us nothing specific. We depend on
you to draw us a picture and all we're seeing is you have a blank page.

: I have an asp file (begin.asp). I want to put something similar to the
: following in it:
: demoName="Test demo"
: salesPersonEmail="first.last"
: specificURL="testURL"

session("demoName") = "Test demo"
session("salesPersonEmail") = "first.last"
session("specificURL") = "testURL"

: The form will then redirect the user to one of two pages (if it is a
: first time user then it goes to one page, if it is a returning user it
: goes to a different page). This is handled by a cookie.
: I want the pages the user gets sent to to retreive the above
: information so it could be utilized.

page1.asp/page2.asp

.
.
.
dim demoName, salesPersonEmail, specificURL
demoName = session("demoName")
salesPersonEmail = session("salesPersonEmail")
specificURL = session("specificURL")
.
.
.

In the begin.asp page i pasted this:
session("demoName") = "AviTest"
session("salesPersonEmail") = "avi.lazar"
session("specificURL") = "http://isn'tThisCool"

In the page that begin.asp redirects to I pasted this:

dim demoName, salesPersonEmail, specificURL
demoName = session("demoName")
salesPersonEmail = session("salesPersonEmail")
specificURL = session("specificURL")

I did not get any errors, but the information was not sent to me in an
e-mail.

Normally, I declare the variables at the top of the second page and
these variables are inserted into an e-mail whenever the page is
accessed. The e-mail is sent to a specific person.

With the code, the pages are accessed, the e-mail is sent but there is
no data where normally there is.
 
A

Avi

Hey guys.

It is working now. When I copy and pasted the code an extra space was
inserted at the end of each code line. Prior to deleting this space it
wasn't working, after deleting it, it was working.

Thanks for all of your help.
 
R

Roland Hall

in message
: It is working now. When I copy and pasted the code an extra space was
: inserted at the end of each code line. Prior to deleting this space it
: wasn't working, after deleting it, it was working.

If it's user input, it's generally a good idea to trim the spaces off.
ltrim, rtrim or trim (left, right, both)

: Thanks for all of your help.

Glad you got it working. Thanks for the update.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top