Microsoft KB Archive/296169

From BetaArchive Wiki
Knowledge Base


PRB: Error "Session Object, ASP 0168" 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("test") = Request.Form("txt");
%>
                

To correct this code sample, add the .Item property as follows:

<%
  Session("test") = Request.Form("txt").Item;
%>
                

REFERENCES

For additional information, click the article number below to view the article in the Microsoft Knowledge Base:

173317 INFO: Active Server Pages' Request.Form and Request.QueryString Return Objects



Additional query words: 80004005 0x80004005

Keywords: kbaspobj kbprb KB296169