G
Guest
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.
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.