Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Cookie Not Being Created on Client Side with ASP

Reply
Thread Tools

Cookie Not Being Created on Client Side with ASP

 
 
Hannibal
Guest
Posts: n/a
 
      08-24-2007
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

 
Reply With Quote
 
 
 
 
Hannibal
Guest
Posts: n/a
 
      08-24-2007
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

 
Reply With Quote
 
 
 
 
Anthony Jones
Guest
Posts: n/a
 
      08-24-2007
"Hannibal" <> wrote in message
news: 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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to execute client-side code _after_ client-side validation? Bogdan ASP .Net 2 06-09-2008 01:31 PM
Client side script after client side validation with asp.net 2.0 Boss302 ASP .Net 0 11-21-2006 08:43 AM
client side asp within server side asp JT ASP General 5 09-09-2004 11:12 PM
Adding custom client-side onClick handler with client-side validator controls Zoe Hart ASP .Net Web Controls 1 01-08-2004 10:45 PM
Cookie not always created in client Andres Denkberg ASP .Net Security 0 07-24-2003 05:23 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57