472,989 Members | 3,056 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,989 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 1213

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Tom | last post by:
Hi, I would like to use the standard PHP sessions and I understand they rely on the target web browser to support session cookies. I have tried the following code: <? session_start(); if...
12
by: chrism | last post by:
Hello, I have a pop-up window that I would like to appear in front of the browser home page when a user opens IE. Problem is, I'd like it to never appear again if the user navigates back to the...
9
by: Agoston Bejo | last post by:
Hi, I searched around everywhere on the net, but could not find a simple example of detecting if cookies are enabled - on server side, and without moving from one page to another. This should be...
0
by: Sri | last post by:
Hi I am trying to figure out how to test whether my browser cookies are enabled. I used the code from the following page...
9
by: SHarris | last post by:
Hello, In our new intranet ASP.NET project, two requirements are that the browser accept cookies AND JavaScript. We are requiring the use of Internet Explorer 6+. 1. Using C# in an ASP.NET...
2
by: Prasad Dannani | last post by:
Hi, I want to know the browser settings like Image Enabled, Cookie Enabled etc., For Cookies and Script Request object has some properties but after disabling certain features also we are...
0
by: dawson | last post by:
I started off by trying to use the HttpCapabilitiesBase.Cookies Property (Note: This property is new in the .NET Framework version 2.0) however it kept on returning true even when I disabled...
24
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How can I see in javascript if a web browser accepts cookies?...
3
by: =?Utf-8?B?Qkw=?= | last post by:
if (Request.Browser.Cookies) { // Cookies supported } else { // Web browser not supports cookies }
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
3
SueHopson
by: SueHopson | last post by:
Hi All, I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...

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.