7

I have an old ASP.NET application that uses SQL Membership and uses aspnet_ tables to manage the logins, passwords, and roles, etc.

I'm wanting to rewrite the application using MVC 5 but it uses ASP.NET Identity and I haven't found an easy way to migrate to it using the new authentication method.

I tried following http://www.asp.net/identity/overview/migrations/migrating-an-existing-website-from-sql-membership-to-aspnet-identity but that doesn't seem to work despite getting all of the SQL scripts to execute fine.

When trying to create a brand new ASP.NET MVC 5 application, I'm at a loss on tying it into my current database. I tried just setting the DB Context connection string to my entity framework connection string but it didn't like that.

Does anyone have any experience migrating an old .NET application to MVC 5 and keeping the database of users?

user3370689
  • 73
  • 1
  • 3
  • I'm currently working on the very same task. Maybe if you specify where exactly are you stuck, what kind of exception are you getting, etc. – Antonin Jelinek Mar 21 '14 at 13:32
  • are you willing to stick with the existing db? I've been able to make that work. – tintyethan Apr 11 '14 at 02:10
  • @tintyethan: Any tips/links/gotchas on how you accomplished that would be appreciated. – Ian W May 18 '16 at 12:52
  • I turned all identity off in the new application and continued using the aspnetservicesdb database. That means changing connection strings and removing references to identity/simple membership. – tintyethan May 18 '16 at 13:36
  • Did you work this out in the end? I'm trying to work this out now! – Ego Placebo Dec 01 '17 at 05:03

2 Answers2

0

I'd say go for data migration if your passwords are not hashed (one-way encryption) in the database. I mean if your using something like DES and AES to encrypt and passwords are recoverable then data migration works for you and you can get rid of the old membership provider.

Otherwise, go for token based authentication and create a WebAPI service on top of the old membership to issue tokens and the rest of the job would be db-agnostic.

akardon
  • 43,164
  • 4
  • 34
  • 42
0

About the password hashing issue mentioned in the previous answer. We managed to solve this problem when moved one of our old web-apps from MVC 3 (with SQL Membership) to ASP.NET Core (with Identity). Here is a blog post with step-by-step instructions

Sergiy
  • 1,912
  • 2
  • 16
  • 25