Does ASP.NET Identity 2 support anonymous users?

asp.net-identity, asp.net-mvc, asp.net-mvc-5, c#

Solution

I want to answer one of the original questions: "I need to be able to differentiate not yet registered users and record their postings in the database.".

I have used Simple Membership before and I am using Asp.Net Identity Framework 2.2.1. In both cases I use anonymous identification to differentiate not yet registered users and authenticated users.

- Enable anonymous identification in your Web.config by adding `<anonymousIdentification enabled="true" cookieName="YOUR_COOKIE_FOR_ANONYMOUS_IDENTIFICATION" />`.

- You can get the anonymous id by `Request.AnonymousID`. That id is a GUID in string format.

- As other users mention, you can use whatever identity system you want, just remember to clear the anonymous id during the log out process. Typically after a user is successfully authenticated, you save either the username / userId with the anonymousId into persistence storage. By clearing the anonymousId when the user logs out, you can make sure the other authenticated users won't be able to associate with the same anonymousId.

- You can clear the anonymousId by `AnonymousIdentificationModule.ClearAnonymousIdentifier()`. Note: the `AnonymousIdentificationModule` is in System.Web.Security assembly. You can add a reference of System.Web or use CTRL + "." on the `AnonymousIdentificationModule` in your code to bring in System.Web.Security.

Problem

I want to allow anonymous/not yet registered and registered users to post on my website. ``` Posts (table) - Id (int) - Subject (nvarchar) - Body (nvarchar) - UserId (uniqueidentifier) ``` The project uses the latest MS technologies (ASP.NET MVC 5+, C#...) How should I go about doing that? Is ASP.NET Identity even the right solution? What's the difference between these: - ASP.NET Identity - SimpleMembership - Membership Provider Update I need to be able to differentiate not yet registered users and record their postings in the database. Update 2 Then have the option to migrate to a registered account. Just like how stackoverflow used to allow anonymous users. Something like this but compatible with ASP.NET Identitfy http://msdn.microsoft.com/en-us/library/ewfkf772(v=vs.100).aspx

Original source

Related problems