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?
-
If you have no people actually using your site, I would just create a new MVC 5 project and copy over the new AccountController stuff. – vidalsasoon Nov 13 '13 at 18:00
-
I agree with @Jim Hill. However, you could try this http://stackoverflow.com/a/19940600/1210574 but even then I am not sure if Identity is compatible with MVC 4. – stink Nov 13 '13 at 19:41
-
I agree with @vidalsasoon - if you are just starting to learn, you do not want to learn by making a new framework work with an old framework - you will hate it. Instead bring your single entity over to your MVC 5 project and go from there. I thought about answering this post but I just don't have the time to do all the research and work it will require. – Jack Nov 16 '13 at 03:01
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.

- 1
- 1

- 2,561
- 4
- 29
- 36
-
1To add to @Dylan's answer I have now written a new article specific ASP.NET Identity, which is the new membership system used in MVC 5. It is called "Decoupling ASP.NET Identify From Your MVC 5 Application" [http://kevin-junghans.blogspot.com/2013/11/decoupling-aspnet-identify-from-your.html]. I have written a new version of SimpleSecurity [http://simplesecurity.codeplex.com/] which uses ASP.NET Identity. This basically has the same API as SimpleMembership to make it easy to plug into application originally developed using MVC 4 that are upgraded to MVC 5. – Kevin Junghans Nov 16 '13 at 14:49
-
2@Dylan, I started the project as MVC 4, so it contained the standard membership for MVC 4. I never implemented it in my software, nor did I ever even register a user simply because this is my first code project, and I wasn't ready to tackle it. When I heard that MVC 5 had a new version I wanted to be sure to upgrade before starting on this part of my code. I was far enough along that I found it too difficult to start from a new project. I ended up creating a separate MVC 5 project, and copying the membership pieces into my old project. It was painful, but a good learning experience. – Jim Hill Nov 16 '13 at 20:12
-
Ah ok. Sounds a bit painful, but i mean, If you were doing this project to learn, and you learned more about the membership process in the end, then I guess it was worth it :) – Dylan Corriveau Nov 16 '13 at 20:48
-
Jim I'm looking to do the same. I have downloaded Visual Studio 2103 Express so that I can get the full mvc web application project files. I have an existing MVC 4 application I have updated to MVC 5. Now I need to upgrade all the Identity & membership stuff. Any info you can give on this? YOu think you could do an answer with the pain points etc?? I will Def upvote it if you do. – Eric Bishard Dec 23 '13 at 19:53