473,405 Members | 2,279 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

cookie confusion

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?
Jul 19 '05 #1
4 2057
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.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
Author: ADO.NET and XML: ASP.NET on the Edge

************************************************** **************************
****
Think Outside the Box!
************************************************** **************************
****
"middletree" <mi********@htomail.com> wrote in message
news:uH**************@TK2MSFTNGP10.phx.gbl...
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?

Jul 19 '05 #2
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?

"Cowboy (Gregory A. Beamer)" <No************@comcast.netRemuvThis> wrote in
message news:O5**************@TK2MSFTNGP11.phx.gbl...
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.

--

Jul 19 '05 #3
I found it. Thanks!!!
"middletree" <mi********@htomail.com> wrote in message
news:u0**************@TK2MSFTNGP11.phx.gbl...
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?

"Cowboy (Gregory A. Beamer)" <No************@comcast.netRemuvThis> wrote in message news:O5**************@TK2MSFTNGP11.phx.gbl...
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.

--


Jul 19 '05 #4
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

"middletree" <mi********@htomail.com> wrote in message
news:u0**************@TK2MSFTNGP11.phx.gbl...
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?

"Cowboy (Gregory A. Beamer)" <No************@comcast.netRemuvThis> wrote in message news:O5**************@TK2MSFTNGP11.phx.gbl...
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.

--


Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: David Graham | last post by:
Hi I have asked this question in alt.php as the time() function as used in setcookie belongs to php - or does it belong equally in the javascript camp - bit confused about that. Anyway, can anyone...
5
by: Charly Walter | last post by:
Hello, Please help. I keep data in several session variables, one of which is a complex object tied to a custom DLL I wrote. Everything seems to be running fine until I introduced a system to...
17
by: James Johnson | last post by:
Dear C#dex, I define a variable: HttpWebRequest webRequest and run the following request webRequest = WebRequest.Create(TARGET_URL) as HttpWebRequest; The webRequest object returns values...
2
by: venkat | last post by:
hi If you close the browser directly then the cookie won't get deleted. When ever you log off only it will get deleted. If you close the browser directly and again the open the browser for the...
2
by: Dinkster | last post by:
BackGround: - We are new to ASP - We thought we would experiment with using the session object (in proc) to store a small amount of data. - We get different results when cookieless is set to...
2
by: Bill Borg | last post by:
Hello all, I am working on forms authentication and trying to understand: what's the relationship between the cookie expiration and the ticket expiration? I create a cookie and I add an...
12
sumittyagi
by: sumittyagi | last post by:
Hi everybody! I am having a difficulty in understanding the prototype pattern. Actually I got the idea behind it, but the example given in wikipedia for this pattern have confused me. The code is...
5
by: sophie_newbie | last post by:
Does anyone know how to do this? I can't seem to make it work. I'm using: c = Cookie.SimpleCookie() c = "unamepwordwhatever" c.expires = time.time() + 300 print c
5
by: cbhoem | last post by:
Hi - I am trying my hand at python cookies. I'm confused about a few things though. Do the python cookies get written to a cookies text file? I have simple code below -- I see the cookie in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.