views:

102

answers:

2

Is there an API to clear anonymous cookie?

A: 

I'm not sure if this is what you are asking, but you can clear all cookies sent to browser as follows:

Response.Cookies.Clear();

If you are having authentication problems, you may want to clarify the question.

HectorMac
+3  A: 

Yes!

 System.Web.Security.AnonymousIdentificationModule.ClearAnonymousIdentifier()

See this useful article : (Migrating Anonymous User Settings)

Also Best way to Migrate Anonymous Profile stackoverflow question.

Simon_Weaver
note: as far as i can tell the two can coexist just fine - so you may not want to remove it. don't just assume that you need to remove it just because you've logged someone in. you can even link the two profiles on the back end - nobody can tell this from client side but it may be useful to track users.
Simon_Weaver
update: I've changed my mind on this somewhat. it seems that Profile_MigrateAnonymous fires not just when a user logs in - but in the presence of both an anonymous and authenticated cookie. my other question may be of interest http://stackoverflow.com/questions/1895266/can-anonymous-and-authenticated-profiles-coexist-together-in-asp-net
Simon_Weaver