|
-
Oct 4th, 2006, 03:13 AM
#1
Thread Starter
Addicted Member
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.
-
Oct 4th, 2006, 03:22 AM
#2
PowerPoster
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.
-
Oct 4th, 2006, 03:26 AM
#3
Thread Starter
Addicted Member
Re: Object Required: Session
That means I cannot do the following:
VB Code:
<%@ Language=VBScript %>
<HTML>
<HEAD>
<Title></Title>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<script language=vbscript>
Sub button1click()
Session.contents("lang_id")=0
end sub
Sub button2_onclick()
Session.contents("lang_id")=1
end sub
Sub button3_onclick()
Session.contents("lang_id")=3
end sub
Sub button4_onclick()
Session.contents("lang_id")=2
end sub
</script>
<link href="main.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></HEAD>
<BODY marginwidth="0" marginheight="0">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<TD><img src="trimg.gif" width="350" height="1">
<INPUT class=btn type=Button size=27 value=English name=button1 onclick="button1click()">
<INPUT class=btn type=Button size=27 value=Chinese name=button2>
<INPUT class=btn type=Button size=27 value=Hungarian name=button3>
<INPUT class=btn type=Button size=27 value=Spanish name=button4>
</TD>
</tr>
<tr><td colspan=2 bgcolor=#666666>
</tr>
</table>
</BODY>
</HTML>
-
Oct 4th, 2006, 03:33 AM
#4
PowerPoster
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|