473,394 Members | 2,052 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Killing Kookies

I am having a devil of a time getting rid of cookies. Because of the
silly 20 cookies/domain limit of IE I need to clear them out when
vistors go from one area through a portal to the next.

Here is the script I am working with:

if (Request.Cookies.Count 0)
{
// Remove all domain cookies
Response.Cookies.Clear();
System.Web.HttpCookie ck;
int cookiejar = Request.Cookies.Count; // This does not
work within the for() statement
for (int i = 0; i < cookiejar; i++)
{
ck = Request.Cookies[i];
ck.Value = null;
ck.Path = "/";
ck.Expires = System.DateTime.Now.AddYears(-1);
Response.Cookies.Add(ck);
}
}
Response.Redirect("someotherurl");

This didn't work, so I tried again with a 200 response instead of a
302.
Here's what it looks like from Fiddler

GET /url.aspx HTTP/1.1
Accept: */*
Accept-Language: en-us
UA-CPU: x86
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET
CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.1; .NET CLR 3.0.04506.30)
Host: mydomain.com
Proxy-Connection: Keep-Alive
Pragma: no-cache
Cookie: searchprefs=somevalue; usersessionid=someguid;
supplierid=someint

And the response is:

HTTP/1.1 200 OK
Via: 1.1 CEREBUS
Connection: Keep-Alive
Proxy-Connection: Keep-Alive
Content-Length: 34
Date: Thu, 22 Mar 2007 14:21:23 GMT
Content-Type: text/html; charset=utf-8
Server: Microsoft-IIS/6.0
Cache-Control: private
X-AspNet-Version: 2.0.50727
Set-Cookie: searchprefs=; expires=Wed, 22-Mar-2006 14:21:23 GMT;
path=/
Set-Cookie: usersessionid=; expires=Wed, 22-Mar-2006 14:21:23 GMT;
path=/
Set-Cookie: supplierid=; expires=Wed, 22-Mar-2006 14:21:23 GMT; path=/

This looks good to me, but the browser does not discard the cookies.
Any ideas?

Mar 22 '07 #1
0 1034

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

Similar topics

1
by: Hari Prasad | last post by:
I wrote an application where I am trying to kill a parent frame with out killing the child one. I have created a frame (F1) and if I click a button on F1 I am getting a new frame (F2). Now, if...
6
by: Colin Steadman | last post by:
I have created a function to kill all session variables that aren't in a safe list. This is the function - Sub PurgeSessionVariables For Each Item In Session.Contents Select Case Trim(Item)...
10
by: Jacek Popławski | last post by:
Hello. I am going to write python script which will read python command from socket, run it and return some values back to socket. My problem is, that I need some timeout. I need to say for...
1
by: krose | last post by:
Hi Using a couple of examples on CodeProject.com I've create a nice little shell extension (adds some custom menus for proprietary file types). Everything is working fine, except I can't get it...
0
by: net guest via DotNetMonster.com | last post by:
Hi, i am facing a lot of problems in killing the orphan excel instances. I approached one method like killing the Excel Orphan with processID. I am getting all the Processess that are running...
14
by: Rob Meade | last post by:
Hi all, Having created a secure login, and then create session variables to detect wether or not a user is logged in - I would now like to be able to off a log out page! :) I have found the...
3
by: kunal.kewalramani | last post by:
I'm opening an Excel file using ASP.NET, but Excel process remains it is not killed, I tried killing it by using Quit() that is also not working, if anybody have any solution for this please help me...
10
by: shiry | last post by:
Hi, I need to do some important cleanup before my console application exists. I used the console ctrl event. This is working well and it fires for all cases, including the CTRL_CLOSE_EVENT (if I...
6
by: laststubborn | last post by:
Hi everybody, We have a very large database and high transaction volume. Time to time these transactions are locking each other and decrease the performance of the database. Is there any way...
6
by: Roger Heathcote | last post by:
sjdevnull@yahoo.com wrote: <snip> Fair point, but for sub processes that need to be in close contact with the original app, or very small functions that you'd like 100s or 1000s of it seems...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.