Browser cookies are enabled - test

Discussion in 'ASP .Net' started by =?Utf-8?B?U3JpLg==?=, Nov 21, 2003.

  1. Hi

    I am trying to figure out how to test whether my browser cookies are enabled.
    I used the code from the following page
    http://msdn.microsoft.com/library/d...us/dv_vstechart/html/vbtchaspnetcookies101.as

    Basically, it tells me to create a cookie and test the cookie from another page. However, in IE 6.0, if I set my privacy setting to a High level so as to block all cookies, the code always returns that the cookies are enabled.

    The code is

    Sub Page_Load(
    If Not Page.IsPostBack The
    If Request.QueryString("AcceptsCookies") Is Nothing The
    Response.Cookies("TestCookie").Value = "ok
    Response.Cookies("TestCookie").Expires =
    DateTime.Now.AddMinutes(1
    Response.Redirect("TestForCookies.aspx?redirect=" &
    Server.UrlEncode(Request.Url.ToString)
    Els
    labelAcceptsCookies.Text = "Accept cookies = " &
    Request.QueryString("AcceptsCookies"
    End I
    End I
    End Su

    In another page: To test the cookies

    Sub Page_Load(
    Dim redirect As String = Request.QueryString("redirect"
    Dim acceptsCookies As Strin
    ' Was the cookie accepted
    If Request.Cookies("TestCookie") Is Nothing The
    ' No cookie, so it must not have been accepte
    acceptsCookies =
    Els
    acceptsCookies =
    ' Delete test cooki
    Response.Cookies("TestCookie").Expires =
    DateTime.Now.AddDays(-1
    End I
    Response.Redirect(redirect & "?AcceptsCookies=" & acceptsCookies,
    True
    End Su

    IE keeps returning acceptsCookies = 1 all the time. When I test the same using Netscape / Mozilla, I get the expected result. So the code works correctly, however not on IE 6.0. Why

    What should I do to enhance the same and give me the correct results? I have set Security to be Highest in Internet, Local Internet, Trusted Sites, Restricted Sites zones and set the Privacy to High to block all cookies.

    Any help is appreciated

    Thanks

    Sri.
     
    =?Utf-8?B?U3JpLg==?=, Nov 21, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Gabor
    Replies:
    3
    Views:
    660
    Jacob Yang [MSFT]
    Aug 26, 2003
  2. =?Utf-8?B?U3Jp?=

    Browser cookies enabled testing

    =?Utf-8?B?U3Jp?=, Nov 21, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    423
    =?Utf-8?B?U3Jp?=
    Nov 21, 2003
  3. _Who
    Replies:
    7
    Views:
    2,770
  4. Toni
    Replies:
    2
    Views:
    1,557
  5. Kyri
    Replies:
    3
    Views:
    157
    Brad Baxter
    Jun 8, 2007
Loading...

Share This Page