473,505 Members | 13,807 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Newbee question: How to kill a cookie?

Hi,

I've implemented the forms authentication just like the following msdn
article http://msdn.microsoft.com/library/de...SecNetHT02.asp
(watch out for the line wrap)

Everything is working fine. Once the user is authenticated, he/she can
navigate out to the secure portion of the site and navigate back while
the ticket hasn't expired.

But the world isn't perfect and I was asked to implement a logoff
option. So I think I need to 'kill' the ticket. I've tryied a lot of
things with no success. For example (cookieName is a var containing
the cookie name generated by the FormsAuthenticationTicket object):

Context.Request.Cookies[cookieName].Expires = DateTime.Now;
or
Context.Response.Cookies[cookieName].Value = null;
or
Response.Cookies[CookieName].Expires = DateTime.Now;
or
Response.Cookies[CookieName].Value = "";
or
Response.Cookies.Remove(CookieName);

None of above expired the ticket, disabling the user to navigate back
to the site's secure area.

Any idea?

TIA

Valmir
Nov 18 '05 #1
3 1762
Tried this?

FormsAuthentication.SignOut()

"xiko tripa" <xi*******@bol.com.br> wrote in message
news:3d**************************@posting.google.c om...
Hi,

I've implemented the forms authentication just like the following msdn
article http://msdn.microsoft.com/library/de...SecNetHT02.asp (watch out for the line wrap)

Everything is working fine. Once the user is authenticated, he/she can
navigate out to the secure portion of the site and navigate back while
the ticket hasn't expired.

But the world isn't perfect and I was asked to implement a logoff
option. So I think I need to 'kill' the ticket. I've tryied a lot of
things with no success. For example (cookieName is a var containing
the cookie name generated by the FormsAuthenticationTicket object):

Context.Request.Cookies[cookieName].Expires = DateTime.Now;
or
Context.Response.Cookies[cookieName].Value = null;
or
Response.Cookies[CookieName].Expires = DateTime.Now;
or
Response.Cookies[CookieName].Value = "";
or
Response.Cookies.Remove(CookieName);

None of above expired the ticket, disabling the user to navigate back
to the site's secure area.

Any idea?

TIA

Valmir

Nov 18 '05 #2
Great! Thanks a lot.

--

---------------
Valmir
"Raterus" <raterus@localhost> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Tried this?

FormsAuthentication.SignOut()

"xiko tripa" <xi*******@bol.com.br> wrote in message
news:3d**************************@posting.google.c om...
Hi,

I've implemented the forms authentication just like the following msdn
article

http://msdn.microsoft.com/library/de...SecNetHT02.asp
(watch out for the line wrap)

Everything is working fine. Once the user is authenticated, he/she can
navigate out to the secure portion of the site and navigate back while
the ticket hasn't expired.

But the world isn't perfect and I was asked to implement a logoff
option. So I think I need to 'kill' the ticket. I've tryied a lot of
things with no success. For example (cookieName is a var containing
the cookie name generated by the FormsAuthenticationTicket object):

Context.Request.Cookies[cookieName].Expires = DateTime.Now;
or
Context.Response.Cookies[cookieName].Value = null;
or
Response.Cookies[CookieName].Expires = DateTime.Now;
or
Response.Cookies[CookieName].Value = "";
or
Response.Cookies.Remove(CookieName);

None of above expired the ticket, disabling the user to navigate back
to the site's secure area.

Any idea?

TIA

Valmir


Nov 18 '05 #3
"Raterus" <raterus@localhost> wrote in message news:<#n**************@TK2MSFTNGP12.phx.gbl>...
Tried this?

FormsAuthentication.SignOut()


Sorry! It didn't work... The user's still able to navigate back to
secure area even after calling FormsAuthentication.SignOut() on the
logoff.aspx
Nov 18 '05 #4

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

Similar topics

3
3340
by: Ralph Freshour | last post by:
I wrote a small .php script that creates a cookie on my local PC - I also wrote one that deletes it. My question is this: when the cookie has been created and I run the delete .php script, when...
2
3323
by: Amit D.Shinde | last post by:
Hello Experts.. I need some help regarding cookies and session objects and also global.asa file I am creating one cookie when a user logs in on my website. The cookie stores the login name of...
2
1630
by: Newbee Adam | last post by:
some said that .NET app can run on any program where rutime exists. What is "runtime" in this sense? will I have to install runtime or .net framework or .NET support on an xp machine for a...
7
7161
by: What-a-Tool | last post by:
How does the expire date work setting it server side with asp. I know with javascript setting it client side it will be set to the clients local time, and therefore expire when the clients local...
9
341
by: EMW | last post by:
I have created a page in aspx and after a click on a button, a new page should open. How is this possible? I tried it doing it like in vb.NET with opening a new form, but it doesn't work. rg,...
13
9921
by: Goofy | last post by:
Does anyone know how I can kill a session by session ID ? -- Goofy
2
1400
by: Mel | last post by:
I have a selection box with 3 values. what i need is to pass 3 urls to a function that has a switch statement and based on the selection index goes on one of the tree urls. Question is how do i...
8
2129
by: =?Utf-8?B?TFc=?= | last post by:
Hello! I am just learning about forms authentication so please excuse this basic question. I am using .NET 1.1 and C#. I have created my web.config file and my login.aspx and the associated cs...
14
1807
by: Mangler | last post by:
Can someone explain the how I can make it so that a login ( username ) can only be logged in once to a website if it is possible. What I would like to do is have it so that if dwaldman is logged...
0
7213
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7098
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
7366
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
7471
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...
0
5610
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4698
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
754
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
406
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.