473,472 Members | 2,038 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

cookie question

I use a browser cookie on an Intranet application. On one certain page, it
checks to see what someone's network name is, then if they are in a certain
department, it redirects them to a particular page. If in other departments,
it redirects them to another page.

Here's the code:

===================================

strLogon= UCASE(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")
strEmployeeID = rs("EmployeeID")
rs.Close
Set rs = Nothing

If strDepartmentID = "9" then
Response.Redirect("DisplaySortableTickets.asp?sele ctTSE="&strEmployeeID&"")
Else
Response.Redirect("DisplaySortableTickets.asp?Assi stEmp="&strEmployeeID&"")
===================================
For some reason, every now and then, I get this in the browser:

Microsoft VBScript runtime error '800a000d'
Type mismatch: 'RS(...).Cookies'
yourticketsredirect.asp, line 22

I have checked and according to the network people, they have not made any
changes. In fact, this error usually goes away in a few minutes. Any
suggestions, comments, or insights to share?


Jul 21 '05 #1
7 1624
What line is line 22? One of the redirect lines?

What happens if you change

strDepartmentID = rs("DepartmentID")
strEmployeeID = rs("EmployeeID")

to

strDepartmentID = rs.Fields.Item("DepartmentID").Value
strEmployeeID = rs.Fields.Item("EmployeeID").Value

?

Ray at work
"middletree" <mi********@htomail.com> wrote in message
news:eu*************@TK2MSFTNGP11.phx.gbl...
I use a browser cookie on an Intranet application. On one certain page, it
checks to see what someone's network name is, then if they are in a
certain
department, it redirects them to a particular page. If in other
departments,
it redirects them to another page.

Here's the code:

===================================

strLogon= UCASE(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")
strEmployeeID = rs("EmployeeID")
rs.Close
Set rs = Nothing

If strDepartmentID = "9" then
Response.Redirect("DisplaySortableTickets.asp?sele ctTSE="&strEmployeeID&"")
Else
Response.Redirect("DisplaySortableTickets.asp?Assi stEmp="&strEmployeeID&"")
===================================
For some reason, every now and then, I get this in the browser:

Microsoft VBScript runtime error '800a000d'
Type mismatch: 'RS(...).Cookies'
yourticketsredirect.asp, line 22

I have checked and according to the network people, they have not made any
changes. In fact, this error usually goes away in a few minutes. Any
suggestions, comments, or insights to share?



Jul 21 '05 #2
Ray:

Yes, sorry I forgot to say which was line 22. Here it is:

Response.Cookies("TSE_ID") = rs("EmployeeID")

I can change that code, but since this problem happens so sproadically and
unpredictably, I'll just have to see what happens.

I do realize that having ".Fields.Item" is better form, but didn't realize
that it caused problems.


"Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
message news:um*************@TK2MSFTNGP15.phx.gbl...
What line is line 22? One of the redirect lines?

What happens if you change

strDepartmentID = rs("DepartmentID")
strEmployeeID = rs("EmployeeID")

to

strDepartmentID = rs.Fields.Item("DepartmentID").Value
strEmployeeID = rs.Fields.Item("EmployeeID").Value

?

Ray at work
"middletree" <mi********@htomail.com> wrote in message
news:eu*************@TK2MSFTNGP11.phx.gbl...
I use a browser cookie on an Intranet application. On one certain page, it checks to see what someone's network name is, then if they are in a
certain
department, it redirects them to a particular page. If in other
departments,
it redirects them to another page.

Here's the code:

===================================

strLogon= UCASE(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")
strEmployeeID = rs("EmployeeID")
rs.Close
Set rs = Nothing

If strDepartmentID = "9" then
Response.Redirect("DisplaySortableTickets.asp?sele ctTSE="&strEmployeeID&"") Else
Response.Redirect("DisplaySortableTickets.asp?Assi stEmp="&strEmployeeID& "") ===================================
For some reason, every now and then, I get this in the browser:

Microsoft VBScript runtime error '800a000d'
Type mismatch: 'RS(...).Cookies'
yourticketsredirect.asp, line 22

I have checked and according to the network people, they have not made any changes. In fact, this error usually goes away in a few minutes. Any
suggestions, comments, or insights to share?




Jul 21 '05 #3
I've heard comments before about how rs("name") returns an object with a
default property of the item's value, but I can't find anything to back that
up. From the error you posted I thought it ~~might~~ have something do do
with that. But, really, it's probably not that likely.
Does this work?

<%
sTest = rs("EmployeeID")
Response.Write "The value is " & sTest
Response.Cookies("TSE_ID") = sTest
%>

Ray at work

"middletree" <mi********@htomail.com> wrote in message
news:eQ**************@TK2MSFTNGP09.phx.gbl...
Ray:

Yes, sorry I forgot to say which was line 22. Here it is:

Response.Cookies("TSE_ID") = rs("EmployeeID")

I can change that code, but since this problem happens so sproadically and
unpredictably, I'll just have to see what happens.

I do realize that having ".Fields.Item" is better form, but didn't realize
that it caused problems.


"Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
message news:um*************@TK2MSFTNGP15.phx.gbl...
What line is line 22? One of the redirect lines?

What happens if you change

strDepartmentID = rs("DepartmentID")
strEmployeeID = rs("EmployeeID")

to

strDepartmentID = rs.Fields.Item("DepartmentID").Value
strEmployeeID = rs.Fields.Item("EmployeeID").Value

?

Ray at work
"middletree" <mi********@htomail.com> wrote in message
news:eu*************@TK2MSFTNGP11.phx.gbl...
>I use a browser cookie on an Intranet application. On one certain page, it > checks to see what someone's network name is, then if they are in a
> certain
> department, it redirects them to a particular page. If in other
> departments,
> it redirects them to another page.
>
> Here's the code:
>
> ===================================
>
> strLogon= UCASE(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")
> strEmployeeID = rs("EmployeeID")
> rs.Close
> Set rs = Nothing
>
> If strDepartmentID = "9" then
> Response.Redirect("DisplaySortableTickets.asp?sele ctTSE="&strEmployeeID&"") > Else
> Response.Redirect("DisplaySortableTickets.asp?Assi stEmp="&strEmployeeID& "") > ===================================
> For some reason, every now and then, I get this in the browser:
>
> Microsoft VBScript runtime error '800a000d'
> Type mismatch: 'RS(...).Cookies'
> yourticketsredirect.asp, line 22
>
> I have checked and according to the network people, they have not made any > changes. In fact, this error usually goes away in a few minutes. Any
> suggestions, comments, or insights to share?
>
>
>
>
>
>
>
>



Jul 21 '05 #4
Is it possible for employeeid to be null?

--
--Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com

"middletree" <mi********@htomail.com> wrote in message
news:eQ**************@TK2MSFTNGP09.phx.gbl...
Ray:

Yes, sorry I forgot to say which was line 22. Here it is:

Response.Cookies("TSE_ID") = rs("EmployeeID")

I can change that code, but since this problem happens so sproadically and
unpredictably, I'll just have to see what happens.

I do realize that having ".Fields.Item" is better form, but didn't realize
that it caused problems.


"Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
message news:um*************@TK2MSFTNGP15.phx.gbl...
What line is line 22? One of the redirect lines?

What happens if you change

strDepartmentID = rs("DepartmentID")
strEmployeeID = rs("EmployeeID")

to

strDepartmentID = rs.Fields.Item("DepartmentID").Value
strEmployeeID = rs.Fields.Item("EmployeeID").Value

?

Ray at work
"middletree" <mi********@htomail.com> wrote in message
news:eu*************@TK2MSFTNGP11.phx.gbl...
>I use a browser cookie on an Intranet application. On one certain page, it > checks to see what someone's network name is, then if they are in a
> certain
> department, it redirects them to a particular page. If in other
> departments,
> it redirects them to another page.
>
> Here's the code:
>
> ===================================
>
> strLogon= UCASE(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")
> strEmployeeID = rs("EmployeeID")
> rs.Close
> Set rs = Nothing
>
> If strDepartmentID = "9" then
> Response.Redirect("DisplaySortableTickets.asp?sele ctTSE="&strEmployeeID&"") > Else
> Response.Redirect("DisplaySortableTickets.asp?Assi stEmp="&strEmployeeID& "") > ===================================
> For some reason, every now and then, I get this in the browser:
>
> Microsoft VBScript runtime error '800a000d'
> Type mismatch: 'RS(...).Cookies'
> yourticketsredirect.asp, line 22
>
> I have checked and according to the network people, they have not made any > changes. In fact, this error usually goes away in a few minutes. Any
> suggestions, comments, or insights to share?
>
>
>
>
>
>
>
>



Jul 21 '05 #5
"Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
message news:Ok**************@TK2MSFTNGP09.phx.gbl...
I've heard comments before about how rs("name") returns an object with a
default property of the item's value, but I can't find anything to back that up.


http://www.msdn.microsoft.com/librar...ieldobject.asp

Quote from second bullet item, "Value is the default property of the Field
object."
Jul 21 '05 #6
Thank you. :]

Ray at work

"Chris Hohmann" <no****@thankyou.com> wrote in message
news:ON**************@TK2MSFTNGP09.phx.gbl...
"Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
message news:Ok**************@TK2MSFTNGP09.phx.gbl...
I've heard comments before about how rs("name") returns an object with a
default property of the item's value, but I can't find anything to back

that
up.


http://www.msdn.microsoft.com/librar...ieldobject.asp

Quote from second bullet item, "Value is the default property of the Field
object."

Jul 21 '05 #7
My guess is rs("EmployeeID") is sometimes null or doesn't exist. Add some
code to check recordcount & check

if ("" & rs("EmployeeID")) = "" then
' blank EmployeeID, handle it somehow
end if

--
Ben Strackany
www.developmentnow.com
"middletree" <mi********@htomail.com> wrote in message
news:eQ**************@TK2MSFTNGP09.phx.gbl...
Ray:

Yes, sorry I forgot to say which was line 22. Here it is:

Response.Cookies("TSE_ID") = rs("EmployeeID")

I can change that code, but since this problem happens so sproadically and
unpredictably, I'll just have to see what happens.

I do realize that having ".Fields.Item" is better form, but didn't realize
that it caused problems.


"Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
message news:um*************@TK2MSFTNGP15.phx.gbl...
What line is line 22? One of the redirect lines?

What happens if you change

strDepartmentID = rs("DepartmentID")
strEmployeeID = rs("EmployeeID")

to

strDepartmentID = rs.Fields.Item("DepartmentID").Value
strEmployeeID = rs.Fields.Item("EmployeeID").Value

?

Ray at work
"middletree" <mi********@htomail.com> wrote in message
news:eu*************@TK2MSFTNGP11.phx.gbl...
I use a browser cookie on an Intranet application. On one certain page, it checks to see what someone's network name is, then if they are in a
certain
department, it redirects them to a particular page. If in other
departments,
it redirects them to another page.

Here's the code:

===================================

strLogon= UCASE(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")
strEmployeeID = rs("EmployeeID")
rs.Close
Set rs = Nothing

If strDepartmentID = "9" then
Response.Redirect("DisplaySortableTickets.asp?sele ctTSE="&strEmployeeID&"")
Else
Response.Redirect("DisplaySortableTickets.asp?Assi stEmp="&strEmployeeID& "") ===================================
For some reason, every now and then, I get this in the browser:

Microsoft VBScript runtime error '800a000d'
Type mismatch: 'RS(...).Cookies'
yourticketsredirect.asp, line 22

I have checked and according to the network people, they have not made any changes. In fact, this error usually goes away in a few minutes. Any
suggestions, comments, or insights to share?





Jul 21 '05 #8

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

Similar topics

3
by: Ralph Freshour | last post by:
I wrote a small .php script that creates a cookie on my local PC - I also wrote one that deletes it. My question is this: when the cookie has been created and I run the delete .php script, when...
6
by: Ajay | last post by:
hi! i am printing a simple cookie, but instead of printing um=name:blah&access:admin&exp:2312390.909 its printing um="name:blah&access:admin&exp:2312390.909" why the quotes?
1
by: koen colen | last post by:
Hello group, I hope you guys can help me out, I am modifying a piece of code from Joe Norman, I did found the code here: http://www.intranet2internet.com/public/default.asp?PAGE=sscript&ID=3 ...
1
by: Display Name | last post by:
Used one of these canned scripts to set up a JS quiz but not before having used another canned PHP script for "Tell your friend about this Web page!" sort of thing. Now i've gotta integrate them;...
7
by: What-a-Tool | last post by:
How does the expire date work setting it server side with asp. I know with javascript setting it client side it will be set to the clients local time, and therefore expire when the clients local...
7
by: odonel | last post by:
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object. Source Error: here is my code: HttpCookie cookie = Request.Cookies;
15
by: Oleg Leikin | last post by:
Hi, (newbie question) I've created some simple .NET ASP application that should store cookies at the client machine. According to the documentation cookie expiration time is set via...
6
by: kelvlam | last post by:
Hello all, I'm still a bit new with JavaScript, and I hope the guru here can shed some light for me. It's regarding handling cookie and the case-sensitive nature of JavaScript itself. My...
3
by: Dan | last post by:
Hi, I am trying to refresh the cookie to make sure the timeout is reset by simply calling a blank page on my site. I am doing this because I have an external site hosted in my web that isn't...
16
by: Stevo | last post by:
I'm guessing this is a laughably obvious answer to many here, but it's not to me (and I don't have a server or any knowledge of PHP to be able to try it). It's not strictly a PHP question, but...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.