Object required: 'Session'
I'm at my wits end...I have a function that works fine on my Production server, but I can't get to work on my test server. Everything I've found on the runtime error '800a01a8' points to not having IIS Virtual directory application created, but it is.
Here's the code:
Function Authenticate (strUserID)
Dim SQLString,DatabaseConnection,UserRecordset,objUser ID,objLevel
'Create a database connection object. Then open the database.
Set DatabaseConnection = Server.CreateObject("ADODB.Connection")
'Create a record set object.
Set UserRecordset = Server.CreateObject("ADODB.Recordset")
SQLString = "SELECT CPMS_UserName, Access_type FROM CPMS_Users_table WHERE (CPMS_UserName = '" & strUserID & "')"
'Run the SQL query.
UserRecordset.Open SQLString, DatabaseConnection
'Test to see if no records match the query. If none do, print a message.
If UserRecordset.EOF Then
Response.Write "<P><B>I'm sorry, but you are not authorized to use this application.</B></P>"
'Put the results of the query into variables.
'**the next two commented lines are the ones that work on production server
'Set Session("objUserID") = UserRecordset("CPMS_UserName")
'Set Session("objLevel") = UserRecordset("Access_type")
Set Session("objUserID") = UserRecordset.Fields.Item("CPMS_UserName").Value
Set Session("objLevel") = UserRecordset.Fields.Item("Access_type").Value
passthru = true
'Close the database.
Set DatabaseConnection = Nothing
Note: see my note above '**
If I uncomment those two lines I lose the session after the database close, but again these lines work fine in production.
Any help is much appreciated.