hi there. i'm trying to troubleshoot some code (that i didn't write...)
it's an ASP web application that includes a menu that is built dynamically. One of the links on the menu is to "logout".
as you can see in the line below, this link posts to the login page, with the logout variable set to true.
Response.write "['Log out " & Session("UserID") & "', 'http://cserver/ds/login.asp?logout=true
When the logout variable is set to true, one of the things that happens is a record is written to an audit log. what's happening is that a session variable called UserID is being wiped out at some point... but i can't figure out where or why.
The function that uses this information looks like:
set rsUser = Server.CreateObject("ADODB.Recordset")
rsUser.ActiveConnection = gConnection
rsUser.Source = "SELECT Uname FROM Users WHERE ID = " + CStr(Session("UserId"))
rsUser.CursorType = 0
rsUser.CursorLocation = 2
rsUser.LockType = 3
I've tried the following:
1. login - test to ensure that the UserID field is populated.
2. when dynamically building the logout option in the menu, i've included the session userid to prove that its still there.
3. when logging out, i've added some debug lines that print out the values of user_id, Session("UserId") and also CStr(Session("UserId")) and they all show the right value...
until i call the rsuser.open method which is when it fails with the error:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'ID ='.
In case you're wondering how i tested this, i just added a response.end right before calling the .open method. when i do that, along with response.writes for the session variable, i can see that everything is actually ok...
finally, if i open the logout link in a new window, it works fine!??
any tips would be appreciated.