Server-side Test if cookies are enabled

T

Toni

I've been trying to come up with am ASP.NET VBScript server-side method to test if a
visitor has cookies enabled in the browser or not. I think I've found a solution, but
I'd like an opinion on whether it really works or not.

<%
' Test if cookies are enabled
IF Request.ServerVariables("HTTP_COOKIE") = "" THEN
Response.Write ("Cookies are DISABLED")
ELSE
Response.Write ("Cookies are Enabled")
END IF
%>

My main website is a techie website and I started counting the visitors with cookies
disabled (excluding crawlers). So far, 628 out of 1691 visitors have cookies disabled.
That's 37%, which is much higher than I expected.

Can anyone tell me if my method of determining if cookies are enabled or not is valid?

Thanks!!!

Toni
 
B

bruce barker

the only way to test if cookies are enabled is to set one, then send a
redirect, and check if the cookie comes back.

-- bruce (sqlwork.com)
 
T

Toni

"bruce", I had already run that test on myself. For my own personal browsing, setting a
cookie then testing after a refresh worked just as well as testing
Request.ServerVariables("HTTP_COOKIE") - and my method is way more efficient!!!

I'm curious as to whether anyone is smart enough to tell me if there are any practical
differences between the two methods?

Toni
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top