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).
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.
Submitted On | |
By | Jeff Allen |
Level | Beginner |
User Rating | 3.5 (21 globes from 6 users) |
Compatibility | ASP (Active Server Pages), VbScript (browser/client side) |
Category |Internet/ Browsers/ HTML World |ASP / VbScript Archive File |
<%@ Language=VBScript %>
<%option explicit
If Len(Request.Cookies("SITESERVER")("ID")) = 0 Then Response.Redirect "BrowserError.asp"
%>