Microsoft KB Archive/296169

= PRB: Error &quot;Session Object, ASP 0168&quot; When You Assign Session Variables in JavaScript =

Article ID: 296169

Article Last Modified on 8/15/2001

-

APPLIES TO


 * Microsoft Active Server Pages 4.0

-



This article was previously published under Q296169



SYMPTOMS
When you try to assign a Request.Form or Request.QueryString variable to a Session variable in your JavaScript code, you receive the following error message on a computer that is running Microsoft Windows NT 4.0 (Internet Information Server 4.0):

Session object error 'ASP 0168 : 80004005'

Disallowed object use

/virdir/page.asp, line xx

An intrinsic object cannot be stored within the Session object.

You receive the following error message on a computer that is running Microsoft Windows 2000 (Internet Information Services 5.0):

Error Type:

Session object, ASP 0168 (0x80004005)

An intrinsic object cannot be stored within the Session object.

/virdir/page.asp, line 4



CAUSE
The values that Request.Form and Request.QueryString return are actually objects rather than strings. This problem occurs because you cannot store Active Server Pages (ASP) intrinsic objects in Session variables.



RESOLUTION
To resolve this problem, perform the necessary explicit casting by using the .Item property of the Request.Form (or Request.QueryString) object.

For example, the following server-side JavaScript code produces this error: <% Session(&quot;test&quot;) = Request.Form(&quot;txt&quot;); %> To correct this code sample, add the .Item property as follows: <% Session(&quot;test&quot;) = Request.Form(&quot;txt&quot;).Item; %>

