Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding MVC 5 Identity to an Existing Project

I am a novice programmer, learning as I work on my first code project. I started with MVC 4 and managed to get CRUD working for a single entity. I decided to try to tackle security next. When Visual Studio scaffolded my MVC 4 project, it added an account model, views, and controller. I have since upgraded my project to MVC 5 and EF 6 using the procedure described here. I now want to replace the MVC 4 security code with MVC 5 scaffolded Identity model, view, controller. Is this possible? If so, how?

like image 383
Jim Hill Avatar asked Nov 13 '13 01:11

Jim Hill


People also ask

How do you implement identity authentication in MVC?

Open a new project in Visual Studio and select Visual C#. In Visual C#, select ASP.NET Web Application and give the project name. Click OK. Step 2: Select MVC template from template type and click Change Authentication button.


1 Answers

Ironically, I was just dealing with this issue a few nights ago...

I would suggest just going to an entirely new MVC 5 application. That being said, I'm not sure how far your application is in development.

What are you using for security right now? I'm going to assume SimpleMembership? If you did, there's a really nice article/project by @Kevin Junghans that involves decoupling simplemembership from your application.

You could theoretically, using that, get away with decoupling simplemembership, then using the answer found here add in identity.

My experience led me to redo-ing it, but again, I'm not sure how far you are in development, so I don't know if that is a viable option or not. If it is, I would just suggest that, and adding in your controllers as you go.

like image 72
Dylan Corriveau Avatar answered Sep 21 '22 14:09

Dylan Corriveau