473,387 Members | 1,464 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,387 software developers and data experts.

Cookie Not Being Created on Client Side with ASP

Hi All,

The below code use to work on my Win2K3 IIS6. for for some unknown
reason it`s no longer working. here the code.

Session("LOGIN_USER_ID") = UserID

' Update the cookie if the login is successful
Response.Buffer = True
Response.Cookies(strAppRoot).Domain = strHelpdeskServer
Response.Cookies(strAppRoot) = UserID

' If the logged in user has administrative privileges, I will
redirect
'to an admin screen where the user can make administrative changes.

'see if the user logging in is the admin
sSQLCmd2 = "SELECT USER_ID FROM USERS WHERE ADMINISTRATOR = 1 AND
USER_ID Like '%" & UserId & "%'"
Set rst2 = Server.CreateObject("ADODB.Recordset")
rst2.Open sSQLCmd2, oDatabaseConn,adOpenForwardOnly, adLockReadOnly,
adCmdText

if not rst2.EOF then
rst2.MoveFirst
adminId = rst2("USER_ID")
adminId = trim(adminId)
end if
rst2.Close
set rst2 = Nothing

if trim(UserID) = adminId then
Session("USER_TYPE") = "Administrator"
else 'the user is not the admin...set the user type and redirect
Session("USER_TYPE") = "User"
end if
Session.Timeout=30 'set the time out for 30 minutes on the session

sSQLCmd3 = "UPDATE [USERS] SET USER_LASTLOGON='" & Cstr(Now()) & "'
WHERE USER_ID = '" & UserID & "'"
oDatabaseConn.Execute sSQLCmd3
Response.Redirect ("home.asp")

I`m not a programmer, I only support the site. But since the original
programmer is gone, I`m the one who has to fix this.

I`m thinking that it may come from a IIS 6 security setting or Windows
Update. My client browser work fine, I get cookie from other site.
Also, I've added my IIS Server to the trusted Sites and added the web
site to accept all cookie.

Also, I try to set IIS 6 to run in IIS 5.0 isolation mode.

I`m running out of idea. If anyone could shed some light it would be
really appreciated

Cheers,

Hannibal

Aug 24 '07 #1
2 4376
I wanted to add this as well...

I`ve created a test page that would just creat a cookie. here is the
code. This is not working as well

<%
Response.Cookies("mycookie") = "testcookie"
Response.Cookies("mycookie").Domain = "developer.be"
Response.Cookies("mycookie").Secure = "False"
Response.Cookies("mycookie").Expires = "January 2, 1997"
%>

<html>
<body>

</body>
</html>
cheers
Hannibal

Aug 24 '07 #2
"Hannibal" <VK******@gmail.comwrote in message
news:11*********************@q5g2000prf.googlegrou ps.com...
Hi All,

The below code use to work on my Win2K3 IIS6. for for some unknown
reason it`s no longer working. here the code.

Session("LOGIN_USER_ID") = UserID

' Update the cookie if the login is successful
Response.Buffer = True
Response.Cookies(strAppRoot).Domain = strHelpdeskServer
Response.Cookies(strAppRoot) = UserID

' If the logged in user has administrative privileges, I will
redirect
'to an admin screen where the user can make administrative changes.

'see if the user logging in is the admin
sSQLCmd2 = "SELECT USER_ID FROM USERS WHERE ADMINISTRATOR = 1 AND
USER_ID Like '%" & UserId & "%'"
Set rst2 = Server.CreateObject("ADODB.Recordset")
rst2.Open sSQLCmd2, oDatabaseConn,adOpenForwardOnly, adLockReadOnly,
adCmdText

if not rst2.EOF then
rst2.MoveFirst
adminId = rst2("USER_ID")
adminId = trim(adminId)
end if
rst2.Close
set rst2 = Nothing

if trim(UserID) = adminId then
Session("USER_TYPE") = "Administrator"
else 'the user is not the admin...set the user type and redirect
Session("USER_TYPE") = "User"
end if
Session.Timeout=30 'set the time out for 30 minutes on the session

sSQLCmd3 = "UPDATE [USERS] SET USER_LASTLOGON='" & Cstr(Now()) & "'
WHERE USER_ID = '" & UserID & "'"
oDatabaseConn.Execute sSQLCmd3
Response.Redirect ("home.asp")

I`m not a programmer, I only support the site. But since the original
programmer is gone, I`m the one who has to fix this.

I`m thinking that it may come from a IIS 6 security setting or Windows
Update. My client browser work fine, I get cookie from other site.
Also, I've added my IIS Server to the trusted Sites and added the web
site to accept all cookie.

Also, I try to set IIS 6 to run in IIS 5.0 isolation mode.

I`m running out of idea. If anyone could shed some light it would be
really appreciated

How do you know it's "not working"? The cookie is only a session cookie so
you won't find it in a permenant cookie store.

What has changed?

This line:-

Response.Cookies(strAppRoot).Domain = strHelpdeskServer

is designed to make the cookie valid for the one of the domains that host
belongs to. For example if the site is:-

www.mydomain.com

then the domain can be set to "mydomain.com". Assuming that the application
is in the root of the web the cookie will be sent to any host in the
mydomain.com domain.

If the value in strHelpdeskServer no longer matches this pattern (e.g, the
domain the server is i presented in no longer matches the contents of
strHelpdeskServer) then the browser will reject the cookie.
--
Anthony Jones - MVP ASP/ASP.NET
Aug 24 '07 #3

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

Similar topics

5
by: Carl | last post by:
Hi, I want to pass the value of the cookie created in VB to ASP. This doesn't work. Any idea? Thanks Carl .... <script language=vbscript> document.cookie="mycookie" '...
12
by: chrism | last post by:
Hello, I have a pop-up window that I would like to appear in front of the browser home page when a user opens IE. Problem is, I'd like it to never appear again if the user navigates back to the...
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...
0
by: obhayes | last post by:
Hi All, Im using classic ASP (3.0) and I have a web farm with 2 webservers (webserver A and webserver B, both windows server 2003). I do not want to store any client specific information on the...
1
by: brad | last post by:
Hi, Im using classic ASP (3.0) and I have a web farm with 2 webservers (webserver A and webserver B, both windows server 2003). I do not want to store any client specific information on the...
5
by: | last post by:
Hi, I'm trying to use the cookie munging session handling behaviour of asp.net instead of cookies themselves as I'm finding quite a few people are barring cookies (especially AOL users). If I...
4
by: 23s | last post by:
I had this problem in the past, after a server reformat it went away, and now after another server reformat it's back again - no clue what's doing it. Here's the flow: Website root is public, no...
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...
3
by: Wysiwyg | last post by:
After a server created cookie is processed on the client I want it removed, cleared, or expired in the javascript block but have been unable to do this. If I set a cookie value in the server code...
7
by: =?Utf-8?B?SlA=?= | last post by:
I need to design a WS that will after authenicating the user, create a cookie on the users PC that made the request. All the code I keep finding is how to get a WS to read a cookie, I need it to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...

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.