Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IdentityConfig is missing in MVC 5

I am migrating my project to MVC 5 and I've just installed Visual Studio 2013 RC. As far as I can see there must be a file named IdentityConfig.cs in the App_Start directory, but even if I create a new project, that file is missing. I am thinking that maybe it could be about version of Visual Studio that I am using. Is there anyway to solve this problem?

Also, I can't add Roles or Membership Providers to web.config. How can I do this with IdentityConfig?

like image 572
Cromwell Avatar asked Oct 11 '13 08:10

Cromwell


People also ask

Where is IdentityConfig CS?

View pages connected to the database using Entity framework. ”IdentityConfig. cs” is mainly for identity, it is located inside of “App_Start” in Solution Explorer.

How do I add IdentityConfig to CS go?

Here is what you can do: You need to update your Visual Studio 2013 to Update 4 or above. Right now I think the latest update is Update 5. Once you do that you will find that it automatically adds the IdentityConfig. cs file in your project(MVC template).


2 Answers

IdentityConfig.cs is no longer required and was removed in the RC version. This is discussed in the article "Introducing ASP.NET Identity". Here is the relevant snippet from this article.

Following are the notable changes from 1.0.0-alpha1 – 1.0.0-beta1

  • In these templates you no longer need IdentityConfig.cs
  • Lots of public APIs were changed for renames and refactoring of code.
  • Transactions support was added to the framework.
like image 136
Kevin Junghans Avatar answered Jan 03 '23 12:01

Kevin Junghans


What you should find in App_Start is a Startup.Auth.cs file configuring the authentication / authorization middleware for the site.

ASP.NET MVC 5 doesn't use the role providers and membership providers that have been around since ASP.NET 2.0. You could still configure those into a web site, but then you'd probably want to get rid of the middleware.

By middleware, I mean most of the authz features are moving into OWIN middleware for ASP.NET. The StartupAuth.cs file and the AccountController in a new MVC 5 project show you a bit how everything can work together, although it is not well documented.

like image 31
OdeToCode Avatar answered Jan 03 '23 13:01

OdeToCode