Results 1 to 4 of 4

Thread: Object Required: Session

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2004
    Posts
    176

    Object Required: Session

    Hi
    I have added a new ASP page to an existing application. On the click of a button, I have to set the value of a Session variable. But when I click the button I get the Error: Object Required: Session
    Does this new page have to be added/referenced by the application to recognise the session variable
    Thanks.

  2. #2
    PowerPoster
    Join Date
    May 2006
    Posts
    2,988

    Re: Object Required: Session

    Session is Server side (within ASP tags), you would need to use Client side cookies if you want to do it on click of a button.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Aug 2004
    Posts
    176

    Re: Object Required: Session

    That means I cannot do the following:

    VB Code:
    1. <%@ Language=VBScript %>
    2. <HTML>
    3. <HEAD>
    4. <Title></Title>
    5. <META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
    6. <script language=vbscript>
    7. Sub button1click()
    8. Session.contents("lang_id")=0
    9. end sub
    10.  
    11. Sub button2_onclick()
    12. Session.contents("lang_id")=1
    13. end sub
    14.  
    15. Sub button3_onclick()
    16. Session.contents("lang_id")=3
    17. end sub
    18.  
    19. Sub button4_onclick()
    20. Session.contents("lang_id")=2
    21. end sub
    22. </script>
    23. <link href="main.css" rel="stylesheet" type="text/css">
    24. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></HEAD>
    25. <BODY   marginwidth="0" marginheight="0">
    26. <table width="100%" border="0" cellspacing="0" cellpadding="0">
    27.   <tr>
    28.         <TD><img src="trimg.gif" width="350" height="1">
    29.         <INPUT class=btn type=Button size=27 value=English name=button1 onclick="button1click()">&nbsp;
    30.         <INPUT class=btn type=Button size=27 value=Chinese name=button2>&nbsp;
    31.         <INPUT class=btn type=Button size=27 value=Hungarian name=button3>&nbsp;
    32.         <INPUT class=btn type=Button size=27 value=Spanish name=button4>&nbsp;
    33.     </TD>
    34.   </tr>
    35.   <tr><td colspan=2 bgcolor=#666666>  
    36.   </tr>
    37. </table>
    38.  
    39. </BODY>
    40. </HTML>

  4. #4
    PowerPoster
    Join Date
    May 2006
    Posts
    2,988

    Re: Object Required: Session

    Right, you will either have to send the variables to another or the same page and do that within ASP tags, or if using Vbscript then would set a cookie. You could even do a location.href with javascript and send the variable to a frame inside the page which then sets the session in ASP ..

    BTW, Vbscript only works in IE .. would be better to use Javascript, unless you are certain the clients will be using IE. .

Posting Permissions

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



Click Here to Expand Forum to Full Width