Microsoft KB Archive/242425

= Using Session Objects with Session State Disabled Returns Type Mismatch Error =

Article ID: 242425

Article Last Modified on 11/21/2006

-

APPLIES TO


 * Microsoft Internet Information Services 5.0
 * Microsoft Internet Information Server 4.0

-



This article was previously published under Q242425



We strongly recommend that all users upgrade to Microsoft Internet Information Services (IIS) version 6.0 running on Microsoft Windows Server 2003. IIS 6.0 significantly increases Web infrastructure security. For more information about IIS security-related topics, visit the following Microsoft Web site:

http://www.microsoft.com/technet/security/prodtech/IIS.mspx



SYMPTOMS
When trying to use a session-level object or variable when session state is disabled, you may receive the following error message:

Microsoft VBScript runtime error '800a000d'

Type mismatch: 'Session'

/scripts/sessiontest/test.asp, line XXX



CAUSE
This behavior is by design. The session object is not registered in the scripting name space, so any executing scripts do not understand it and return a "Type mismatch" error message.



MORE INFORMATION
The following steps will reproduce this behavior.  Disable session state at the folder or site level:

 Select a Web site or folder in the Microsoft Management Console (MMC). Right-click the item and select Properties. Select the Directory or Home Directory tab. Click Configuration or Create, and then click Configuration. Select the App Options tab</li> Clear the Enable Session State box.</li> Click OK to return all the way back to the MMC.</li>  Create a page in the application's physical folder named Sesstest.asp with the following contents: <% Session("strTest") = "Some Text" %> </li> Browse the page. You should see the error.</li></ol> </li> Disable session state at the page level:

<ol style="list-style-type: lower-alpha;"> Highlight a Web site or folder in the MMC.</li> Right-click the item and select Properties.</li> Select the Directory or Home Directory tab.</li> Click Configuration or Create and then click Configuration.</li> Select the App Options tab.</li> Select the Enable Session State check box.</li> Click OK to return all the way back to the MMC.</li>  Create a page in the application's physical folder named Sesstest.asp with the following contents: <% @EnableSessionState = False %> <% Session("strTest") = "Some Text" %> </li> Browse to the page. You should see the error.</li></ol> </li></ol>

Additional query words: iis asp

Keywords: kbprb kbpending KB242425

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.