Is it possible to access ASP.NET anonymous profile for a logged in user?

Posted by Simon_Weaver on Stack Overflow See other posts from Stack Overflow or by Simon_Weaver
Published on 2009-11-04T23:17:35Z Indexed on 2010/05/02 0:57 UTC
Read the original article Hit count: 569

The ASP.NET membership supports anonymous users and logged in users.

If you call FormsAuthentication.SetAuthCookie(userName, createPersistentCookie); with a true for createPersistentCookie then the user will be logged in automatically when they revisit your site - even after closing the browser. If you don't enable this 'remember me' feature, then the anonymous cookie will still be around when the user visits your site again.

I'd like to do be able to store information in the user's anonymous profile when they are logged in. i.e. I don't want them to remain authenticated on the site if they go away and come back, but I'd still like be able to track certain things - like perhaps a visitCount property in the anonymous profile.

Is there any way to access a user's anonymous profile when they are authenticated. The two cookies exist so it should be possible. I don't want to reinvent half the wheel!

ps. I realize that tracking is skewed if multiple users use the system but thats fine.

© Stack Overflow or respective owner

Related posts about asp.net-membership

Related posts about asp.net-profiles