passing an asp value from page to another

Results 1 to 3 of 3

Thread: passing an asp value from page to another

  1. #1
    Join Date
    Dec 1969

    Default passing an asp value from page to another

    How can i pass an value calculated on an asp form, another asp page? I believe you can use cookies for this but is there any example available for this?<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: passing an asp value from page to another

    You can use several methods, although others in this forum will have better ideas than me. You can use a cookie, use a session variable, pass the value in the URL, or pass the value using a form. It doesn&#039;t sound like you&#039;re using a form here, so I&#039;ll give you examples for the first three. I would also search this site and others for more information on these topics.<BR><BR>Page 1:<BR>calculatedValue = 10<BR><BR>&#039; use cookies<BR>response.cookies("calcVal") = calculatedValue<BR>response.cookies("calcVal").Exp ires = DateAdd("d", 1, Now)<BR><BR>&#039; use session variables<BR>session("calculatedValue") = calculatedValue<BR><BR>&#039; pass the value in the URL using HTML<BR>&#060;a href="nextpage.asp?calcVal=calculatedValue"&#062;n ext page&#060;/a&#062;<BR><BR>Page 2:<BR><BR>&#039; read and write value from cookie<BR>response.write(request.cookies("calcVal" ))<BR><BR>&#039; write session variable<BR>response.write(session("calculatedVari able"))<BR><BR>&#039; read and write from URL<BR>response.write(request.querystring("calcVal "))<BR>

  3. #3
    Join Date
    Dec 1969

    Default Keep it simple...use session variable...

    MUCH easier and less error-prone. And unless your web site is getting *thousands* of hits per hour, it&#039;s a fine solution.<BR><BR>Page1:<BR> &#060;%<BR> Session("SaveFoo") = foo<BR> %&#062;<BR><BR>Page2:<BR> &#060;%<BR> foo = Session("SaveFoo")<BR> %&#062;<BR><BR>If you *know* that you are done with the session variable after page 2, then do:<BR>Page2:<BR> &#060;%<BR> foo = Session("SaveFoo")<BR> Session.Contents.Clear "SaveFoo"<BR> %&#062;<BR>But it&#039;s not real important that you do that.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts