Server-side Test if cookies are enabled

  • Thread starter Thread starter Toni
  • Start date Start date
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
 
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)
 
"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
 
Back
Top