471,089 Members | 1,654 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,089 software developers and data experts.

Browser cookies are enabled - test

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/de...tcookies101.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.
Nov 18 '05 #1
0 1139

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Sri | last post: by
2 posts views Thread by Prasad Dannani | last post: by
reply views Thread by dawson | last post: by
3 posts views Thread by =?Utf-8?B?Qkw=?= | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.