Checking for cookies

Page 1 of 4 123 ... LastLast
Results 1 to 10 of 39

Thread: Checking for cookies

  1. #1
    Manpreet Guest

    Default Checking for cookies

    hey is there a way to check if the client has disabled cookies??<BR><BR>

  2. #2
    David Morgan Guest

    Default RE: Checking for cookies

    Easy...<BR><BR>Set one, and then get them to navigate to another page, and see if it exists.<BR><BR>Response.Cookies("ClientID") = stClientID<BR>Response.Cookies("ClientID").Expires = "December 31, 2001"<BR><BR>Next page<BR><BR>stClientID = Request.Cookies("ClientID")<BR><BR>If stClientID = "" Then<BR> No Cookies<BR>End If

  3. #3
    Join Date
    Dec 1969
    Posts
    4

    Default RE: Checking for cookies

    Why do not use javascript to check this.<BR>"Navigator.cookiesEnabled". In case any one of u have a reason for not using it please mail me at amitlohia@hotmail.com

  4. #4
    Adam Sobot Guest

    Default RE: Checking for cookies

    That would only work if JavaScript was enabled on the browser - which, like cookies being enabled, cannot be guaranteed.<BR>You would need an alternative for non-JavaScripters.


  5. #5
    Join Date
    Dec 1969
    Posts
    555

    Default RE: Checking for cookies

    If they don&#039t have javascript enabled on their browser then you don&#039t want them coming to your site in the first place. It&#039s a W3C standard (ECMAScript) for crying out loud. One of the precious few standards for sure, but still a standard nonetheless. Turning off cookies and javascript on a browser and then going surfin&#039 on the &#039net is a new twist on the "take a shower with your raincoat on" analogy. WHY DO IT????

  6. #6
    Join Date
    Dec 1969
    Posts
    552

    Default RE: Checking for cookies

    You would also have to check to see if the user is accepting javascript, and I am not sure how you would do that.. Easier to do the server side way..

  7. #7
    Join Date
    Dec 1969
    Posts
    213

    Default RE: Checking for cookies

    This works if user enables session cookies<BR><BR>If Instr(1,UCASE(Request.ServerVariables("HTTP_COOKIE ")),"ASPSESSIONID",VbBinaryCompare) &#062; 0 Then<BR> Response.write &#039cookies enabled&#039<BR>End if

  8. #8
    spacedog Guest

    Default RE: Checking for cookies

    Here&#039s an alternate method that uses redirects and session variables to check for cookie acceptance. It relies on the fact that Session variables depend on cookies to maintain user state. <BR><BR>Put the following code on the start page. Let&#039s call this default.asp:<BR><BR>If Session("cookietest") = "" then<BR> Session("cookietest") = "check if cookies are enabled"<BR> Response.Redirect("checkcookies.asp")<BR>End If<BR>&#039page contents go here.<BR><BR>Now put the following code in checkcookies.asp:<BR><BR>If Session("cookietest") = "" then<BR> Response.Write("Please set your browser to accept cookies.")<BR>Else<BR> Response.Redirect("default.asp")<BR>End If<BR><BR>

  9. #9
    Joseph Lee Guest

    Default what about 1st page?

    what if the entry point the user came into your site needed to know if cookies are enabled or disabled? how would you be able to detect if cookies are enabled on the first page they go to on your site?

  10. #10
    Join Date
    Dec 1969
    Posts
    940

    Default RE: Checking for cookies

    Try this, pretty simple when you know how. Do you know how to detect if Javascript is enabled ? by the server side witout any Active X.<BR><BR>Dim intPos &#039 As Integer<BR>intPos = InStr(Request.ServerVariables "ALL_HTTP"), "HTTP_COOKIE")<BR>If (intPos &#062; 0) Then<BR> &#039 Cookies enabled...<BR>Else<BR> &#039 Cookies disabled<BR>End If

Posting Permissions

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