In this post you will learn about a very new enhancement in ASP.NET Framework technologies (MVC, Web Forms, Web Pages, Web API and SignalR) known as ‘ASP.NET Identity System’ with the release of Visual Studio 2013. This enhancement well defines the meaning of ‘One ASP.NET’, because this can be used with all ASP.NET Framework technologies more easily than before.
ASP.NET Identity System is a new Membership system for building ‘One ASP.NET’ applications. It allow us to add login features to our application and makes it easy to customize data about the logged in user. The whole Membership system is re-written by ASP.NET team to support ‘One ASP.NET’ goal, don’t worry earlier membership systems including ‘Simple Membership provider’ is still supported, if you want to migrate them then here is a nice KB for you by ASP.NET Team.
You can learn more about this new feature here.
Now, let’s look at all the features of ASP.NET Identity System:
One ASP.NET Identity System
This cool new ‘ASP.NET Identity’ can be used with all of the ASP.NET Frameworks including MVC, Web Forms, Web Pages, Web API and SignalR. In Visual Studio 2013 IDE when we do File | New Project (.NET 4.5) | we see ‘ASP.NET Web Application’ as a parent project template and under this we get option to pick project types from MVC, Web Forms, Web Pages, Web API, SignalR and for all this one identity will be supported.
Easily plug more profile data about the user
What about adding user’s first name, last name, date of birth etc while creating new user account in the application? It was really difficult before to add these extra information while registering new user. Now, with ASP.NET Identity System, it is easy to add extra information about the user. ASP.NET Identity uses Entity Framework Code First and it is possible to extend the POCO classes.
ASP.NET Identity System uses Entity Framework Code First to implement all of its persistence control to store user information in databases such as SharePoint, Azure Table Service, No Sql databases etc. Now, we can easily plug in different storage providers which was quite a painful task before.
ASP.NET Identity System makes the web application more unit testable. Now we can write Unit Tests for the parts of our application that use ASP.NET Identity.
ASP.NET Identity supports claims-based authentication, where the user's identity is represented as a set of claims.
This is one of the main reason in re-writing the membership system. Today we are looking more on social networks and wishing to extend the ability of our application to allow logins with Microsoft, Facebook, Twitter, Google, Yahoo accounts and even login using Windows Azure Active Directory and store user data in our application. So, this ASP.NET Identity System is well designed to enable these functionality.
With Visual Studio 2013, these bits are already included with templates but in case if you migrating your existing application then you can download the bits from NuGet. You need to install these two packages:-
Microsoft.Aspnet.Identity.Core - This package contains the core interfaces of ASP.NET Identity.
Microsoft.Aspnet.Identity.EntityFramework - This package contains the implementation of ASP.NET Identity System which works with Entity Framework Code First. This means that if you use this package then you can store information in a SQL Server database. Also we can easily plug other databases if we wanted.
Hope this helps.