Calling ASP variable to another ASP file

Discussion in 'ASP General' started by Avi, Nov 2, 2005.

  1. Avi

    Avi Guest

    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
     
    Avi, Nov 2, 2005
    #1
    1. Advertising

  2. Avi

    Evertjan. Guest

    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 %>


    --
    Evertjan.
    The Netherlands.
    (Replace all crosses with dots in my emailaddress)
     
    Evertjan., Nov 2, 2005
    #2
    1. Advertising

  3. Avi

    Avi Guest

    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
     
    Avi, Nov 2, 2005
    #3
  4. Avi

    Evertjan. Guest

    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"?



    --
    Evertjan.
    The Netherlands.
    (Replace all crosses with dots in my emailaddress)
     
    Evertjan., Nov 2, 2005
    #4
  5. Avi

    Roland Hall Guest

    "Avi" wrote in message
    news:...
    : 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
     
    Roland Hall, Nov 4, 2005
    #5
  6. Avi

    Avi Guest

    Roland Hall wrote:
    > "Avi" wrote in message
    > news:...
    > : 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


    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.
     
    Avi, Nov 4, 2005
    #6
  7. Avi

    Avi Guest

    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.
     
    Avi, Nov 4, 2005
    #7
  8. Avi

    Roland Hall Guest

    "Avi" wrote in message
    news:...
    : 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
     
    Roland Hall, Nov 5, 2005
    #8
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brian
    Replies:
    3
    Views:
    439
    Siemel Naran
    Apr 19, 2004
  2. Nmishra
    Replies:
    3
    Views:
    376
    Default User
    May 24, 2004
  3. S?ren Gammelmark
    Replies:
    1
    Views:
    1,963
    Eric Sosman
    Jan 7, 2005
  4. Navaneeth
    Replies:
    4
    Views:
    571
    Kenny McCormack
    Nov 20, 2010
  5. Yigit Turgut
    Replies:
    5
    Views:
    204
    Terry Reedy
    Jan 10, 2012
Loading...

Share This Page