Cookies in client browser

Results 1 to 3 of 3

Thread: Cookies in client browser

  1. #1
    Tanvi Guest

    Default Cookies in client browser

    Could any body tell me how to find whether cookies are enabled in client&#039s browser <BR><BR>tanviss@hotmail<BR>Thankyou

  2. #2
    Olof Guest

    Default RE: Cookies in client browser<BR><BR>//Olof

  3. #3
    Join Date
    Dec 1969

    Default RE: Cookies in client browser

    Here&#039s a simple way...<BR><BR>When they first hit your site, try writing a simple cookie to them, i.e.:<BR><BR>Response.Cookies("cookietest") = "True"<BR><BR>Then, redirect them to another page and ask for that cookie value. If they don&#039t have cookies enabled, you will get back an empty string (""). So...<BR><BR>testCookieValue = Request.Cookies("cookietest")<BR>If testCookieValue = "" Then<BR> Response.Redirect "noCookies.htm"<BR>End If<BR><BR>As you can see, if the test cookie value comes back blank, I redirect them to a no cookies page or whatever the case requires.<BR><BR>This has worked for me. Keep in mind that if you do both steps (trying to write the cookie AND requesting the cookie value) in the same page, this technique won&#039t work. You&#039ll actually (falsely) get the cookie value back regardless of whether or not they have cookies enabled. You&#039ve got to do it on a separate page.<BR><BR>One more thing: I use this technique at work, and my company is still using ASP 2.0. It&#039s possible there might be a simpler solution in ASP 3.0 and beyond, or if you have access to a browser sniffing server component like BrowserHawk or something.<BR><BR>Hope this helps.

Posting Permissions

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