Detect if Cookies are Enabled with 1 (that's one!) line of code
In looking for an easy way to detect the client browser's cookie settings, everything I've found has been complex. Each example I've found requires a page refresh or redirect to itself. This severely hampers true application development as the Request.Form collection is then cleared. This code is something simple I stumbled on and it works (see explanations).
Original Author: Jeff Allen
Assumptions
I have NOT tested this on ALL platforms or with all clients, however, since the SITESERVER/ID cookie key links the client to a session established on the server, I'm fairly certain it will work for all cases. Please don't shoot me if it doesn't. :) I DO know that it works on Microsoft IIS and with IE v5 or better. I included in my example a redirect to an error page, however you could do absolutely anything you wanted if the test was true.
Code
<%@ Language=VBScript %>
<%option explicit
If Len(Request.Cookies("SITESERVER")("ID")) = 0 Then Response.Redirect "BrowserError.asp"
%>
Loading Comments ...
Comments
No comments have been added for this post.
You must be logged in to make a comment.