473,386 Members | 1,785 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,386 software developers and data experts.

Getting rid of session cookie ("ASP.NET_SessionId")

Hi all,

I have an application that when finished redirects to a non-ASP.NET app
which is choking on a huge ASP.NET session cookie. The cookie
"ASP.NET_SessionId" gets transmitted by the browser (IE6 in test case)
despite trying Microsoft's suggested method of expiring the cookie first.

I'd like to be able to kill the cookie and do a Response.Redirect() from
within a server-side button handler, but I'm to the point now where I'm
instead redirecting to a third .aspx page whose only job is to remove the
cookie and have a hyperlink out. In its Page_Load:

{
System.Web.HttpContext.Current.Session.Abandon();

HttpCookieCollection cookieColl = HttpContext.Current.Request.Cookies;
String[] names = cookieColl.AllKeys;
System.Web.HttpContext.Current.Trace.Write(String. Format("{0} cookies:",
names.Length));
for (int i = 0; i < names.Length; i++) {
HttpCookie cookie = cookieColl[names[i]];
System.Web.HttpContext.Current.Trace.Write(String. Format(" {0}",
names[i]));
cookie.Expires = DateTime.Now.AddDays(-1);
cookie.Domain = "invaliddomain";
cookie.Path = "invalidpath";
cookie.Value = "invalidvalue";
Response.Cookies.Add(cookie);
}
}

.... but on clicking the hyperlink, the cookie yet lives.

Any ideas? Is this something specific to IE6 perhaps, some security update
that special-cases ASP.NET cookies? Any help is appreciated.

Thanks,
--Dan Michaeloff
Nov 19 '05 #1
1 9109
Daniel Michaeloff wrote:
Hi all,

I have an application that when finished redirects to a non-ASP.NET
app which is choking on a huge ASP.NET session cookie. The cookie
"ASP.NET_SessionId" gets transmitted by the browser (IE6 in test case)
despite trying Microsoft's suggested method of expiring the cookie
first.

I'd like to be able to kill the cookie and do a Response.Redirect()
from within a server-side button handler, but I'm to the point now
where I'm instead redirecting to a third .aspx page whose only job is
to remove the cookie and have a hyperlink out. In its Page_Load:

{
System.Web.HttpContext.Current.Session.Abandon();

HttpCookieCollection cookieColl =
HttpContext.Current.Request.Cookies; String[] names =
cookieColl.AllKeys;
System.Web.HttpContext.Current.Trace.Write(String. Format("{0}
cookies:", names.Length)); for (int i = 0; i < names.Length; i++) {
HttpCookie cookie = cookieColl[names[i]];
System.Web.HttpContext.Current.Trace.Write(String. Format("
{0}", names[i]));
cookie.Expires = DateTime.Now.AddDays(-1);
cookie.Domain = "invaliddomain";
cookie.Path = "invalidpath";
cookie.Value = "invalidvalue";
Response.Cookies.Add(cookie);
}
}

... but on clicking the hyperlink, the cookie yet lives.

Any ideas? Is this something specific to IE6 perhaps, some security
update that special-cases ASP.NET cookies? Any help is appreciated.

Thanks,
--Dan Michaeloff


What probably happens is that the ASP.Net system automatically
adds that cookie, overwriting your "remove this cookie" version.

Try adding a "EnableSessionState=False" to the @ Page directive in the aspx,
maybe this will get rid of the new session cookie.

Hans Kesting
Nov 19 '05 #2

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

Similar topics

2
by: Mindful_Spirit | last post by:
I'm trying to set up a basic email feed back form like this, and was wondering about some basic configuration settings. I have used code from this website. I have it working just fine. I'm...
8
by: whtevr | last post by:
Consider this HTML on an ASP page called default.asp in a virtual directory: <FORM name="Flogin" id="Flogin" action="" method=post> </FORM> Do I HAVE to put the literal "default.asp" into the...
0
by: Joeyej | last post by:
Hi - I'm trying to move/use a web form (containing some javascript field checks) previously hosted on a Windows 2000 server. However, the FORM METHOD="post..." command in the form (shown below)...
1
by: Edward King | last post by:
I have a statement in a asp,like follows£º var str=window.top.main.document.all.contenttext.value; I use IIS5.0 to deploy this asp,then I visit this asp like follows:...
2
by: McKirahan | last post by:
If I have a Web page invoked via http://myDomain.com/What.htm that references an ASP page via the <img> tag's "src=" like this: <html> <head> <title>Page.htm</title> </head> <body> <img...
4
by: keithb | last post by:
It looks like the span tag cannot be used with asp tables. What is the best way to make an irregular asp table? Thanks, Keith
1
by: Electric Co. | last post by:
Hello, I have two questions: 1.) Could I create a custom server control in 2005 in order to leverage the CompositeControl base class and then use that control in 2003? (fingers crossed but...
1
by: mark4asp | last post by:
Which should I use: 1. "ASP.NET AJAX-Enabled Web Site" or 2. "AJAX Control Toolkit Web Site"? In the first, controls from the control toolkit start as: <cc1:SomeControl></cc1> In the 2nd,...
0
by: Crash | last post by:
..NET Framework 1.x, 2.x, 3.x... ASP.NET 5.0, 5.1, 6.0... Windows Server 2000, XP, Server 2003... I am using NAnt & the NAnt contrib library to automate virtual directory maintenance tasks on...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.