Checking for Cookies

Results 1 to 3 of 3

Thread: Checking for Cookies

  1. #1
    Brian W. Guest

    Default Checking for Cookies

    Can anyone point me to a reliable way to determine if cookies are enabled using VBScript on a single page (without posting to itself)? If not, what is the best source you have found to determine if cookies are enabled?<BR><BR>Here is what I am trying to do: <BR>A visitor hits our site for the first time (on any page). The visitor is given a unique ID which stored in a cookie and is recorded to our database along with the visitor&#039;s refering URL. The problem is I&#039;m getting a lot of search engine bot hits that have cookies disabled and I&#039;m recording 50 to 100 bot cookies per actual visitor cookie. I only want to record visitors with cookies enabled. <BR><BR>I tried writing a cookie to the visitor and reading the cookie (and/or also checking .haskeys) on the same page before writing the cookieID to the database, but the database is updated even if cookies are disabled. <BR><BR>Any suggestions?

  2. #2
    Brian W. Guest

    Default RE: Checking for Cookies

    Looking through some old posts I found the following code. Does anyone have a better suggestion?<BR><BR>&#060;%<BR>If InSTR(Request.ServerVariables("ALL_HTTP"), "HTTP_COOKIE") &#062; 0 Then <BR> &#039;cookies are enabled<BR>Else<BR> &#039;cookies are disabled<BR>End If<BR>%&#062;

  3. #3
    Mr. Mike Guest

    Default RE: Checking for Cookies

    I&#039;m interested in checking for cookies too but the code you listed does not work for the first page:<BR><BR>If InSTR(Request.ServerVariables("ALL_HTTP"), "HTTP_COOKIE") &#062; 0 Then <BR><BR>It works great for me on the second page, but on the first page the Request.ServerVariables occurs before the session cookie is written. Any suggestions?<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts