cookie confusion

M

middletree

I am doing an Intranet-based app. For one set of pages on the app, I want to
grab the user's network logon ID. I have chosen to do this with this code:
----------------------------------------------------------------------------
strLogon= Request.ServerVariables("LOGON_USER")

Set RS = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT EmployeeID, DepartmentID "
strSQL = strSQL & "FROM Employee "
strSQL = strSQL & "WHERE NetworkID = '"&strLogon&"'"
RS.Open strSQL, objConnection

'this is to pass the value of the name of the TSE to the next page
Response.Cookies("TSE_ID") = rs("EmployeeID")
strDepartmentID = rs("DepartmentID")
rs.Close
Set rs = Nothing

If strDepartmentID = "9" then
Response.Redirect("DisplayOpenTicketsTSE.asp")
Else
Response.Redirect("DisplayOpenTickets.asp")
end if
----------------------------------------------------------------------------
----

In production, this works just fine. If you happen to be in the tech support
department, (9), it takes you to a page which shows you just your open
tickets, and if not, it takes you to a page which displays all open tickets.

I decided to create a development environment for this app, which I should
have done in the first place, and so I copied the SQL Server 2K database,
then copied the asp code down into my wwwroot directory. The pages which
don't have the cookie code work just fine, but the ones that do have cookie
stuff do not work. These are just browser cookies, and their only purpose is
to get the Windows logon name, nothing else. I have no experience with any
cookies prior to this.


Here's the error message I get:
Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch: 'RS(...).Cookies'
/displayopenredirect.asp, line 17

where line 17 is the one in the middle of the above code:
Response.Cookies("TSE_ID") = rs("EmployeeID")


I'm having a hard time understanding why this work in prod, but not in my
dev environment. The dev environment is on the network, so it should be able
to grab my logon name exactly as it does when running from the prod server.
When I see "type mismatch", I immediately think that maybe the datatype in
the database is different between prod and dev, but that is not the case.
It's an int in both cases.

Can anyone help me?
 
C

Cowboy \(Gregory A. Beamer\)

Most likely you have anonymous access on on the dev box, but off on the
production server. If so, the user logging on is "IUSR_{ComputerName}" and
not you. Try this:

Response.Write(strLogon)

and see who it is logged on with on each server.
 
M

middletree

You are correct, thanks. I did a response.write, and it was blank. There is
no value in strLogon. So can you give me a hint what you mean about
anonymous access?
 
T

TomB

Open Internet Services Manager from Control Panel --> Administration Tools
Right Click your web and hit properties, go to the Directory Security tab,
remove the check from anonymous access
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

cookie question 7
0x800A0E7D error--don't get it 8
Cookie Problems 1
cookie testing 1
The cookie is crumbling... 1
Cookie Confusion - How to Set a Cookie 5
cookie problems 1
Empty cookie! 1

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top