473,809 Members | 2,699 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Cookie s(strAppRoot).D omain = strHelpdeskServ er
Response.Cookie s(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.CreateOb ject("ADODB.Rec ordset")
rst2.Open sSQLCmd2, oDatabaseConn,a dOpenForwardOnl y, 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_T YPE") = "Administra tor"
else 'the user is not the admin...set the user type and redirect
Session("USER_T YPE") = "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.E xecute sSQLCmd3
Response.Redire ct ("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 4413
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.Cookie s("mycookie") = "testcookie "
Response.Cookie s("mycookie").D omain = "developer. be"
Response.Cookie s("mycookie").S ecure = "False"
Response.Cookie s("mycookie").E xpires = "January 2, 1997"
%>

<html>
<body>

</body>
</html>
cheers
Hannibal

Aug 24 '07 #2
"Hannibal" <VK******@gmail .comwrote in message
news:11******** *************@q 5g2000prf.googl egroups.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.Cookie s(strAppRoot).D omain = strHelpdeskServ er
Response.Cookie s(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.CreateOb ject("ADODB.Rec ordset")
rst2.Open sSQLCmd2, oDatabaseConn,a dOpenForwardOnl y, 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_T YPE") = "Administra tor"
else 'the user is not the admin...set the user type and redirect
Session("USER_T YPE") = "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.E xecute sSQLCmd3
Response.Redire ct ("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.Cookie s(strAppRoot).D omain = strHelpdeskServ er

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.c om". 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 strHelpdeskServ er no longer matches this pattern (e.g, the
domain the server is i presented in no longer matches the contents of
strHelpdeskServ er) 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
2089
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" ' also tried with document.cookie="name=mycookie"
12
18024
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 home page during their time using the browser. However, if the user closes the browser, then reopens, the pop-up should appear again. (you may have guessed that this will be used for public access pc's.) I want to try as best I can to catch...
7
7226
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 time reaches the set expire-time. But if it is an expire time set on my server in California, and the cookie is put on a computer that is running on London Time, and the expire time is set at the server as 20 minutes from now, the London computer...
0
2501
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 webserver (therefore do not intend to use the session object- as you cannot gaurantee which server the user will go to). I want to store a small value (e.g. a Y/N value or an Id) on the client machine for the duration of their browsing session,...
1
4615
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 webserver (therefore do not intend to use the session object- as you cannot gaurantee which server the user will go to). I want to store a small value (e.g. a Y/N value or an Id) on the client machine for the duration of their browsing session, hence I...
5
3049
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 change the setting in web.config everything seems to work fine as long as I'm using relative paths. The problem is I've got a menuing system that's generated from a site-wide template - so I use a fixed path from the application root - (ie:...
4
5647
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 SSL no forms auth. One of the subfolders in the public area is the root of a "protected" area; SSL is required from this subfolder on forward and a web.config in the subfolder specifies forms authentication. From the public area, I provide a...
15
3654
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 HttpCookie.Expires property, but property value is the time of day on the client. How can I possibly know client local time ?
3
11130
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 behind and don't use a domain then I can not change or remove that cookie's value on the client. If I subsequently create the cookie again in the codebehind then I actually end up with TWO cookies with the same name in the response. The cookie...
7
1999
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 create one. The below code doesnt add the cookie to my cache. However if I place this in an non asmx page its fine Any help you offer is apperiated public string CreateToken(string User, string App, string County) {
0
9721
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10640
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10120
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7662
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6881
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5550
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5689
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4332
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.