I have a database that has been in place for a few years. One of our web apps uses Membership Provider and the tables in the database that were created when it was setup. This older app uses MVC 4.0.
I have a new web app that I am creating that needs to use the same database. When I created the project, it used MVC 5.
The new app does not need to use the same logins as the older application but it does need to use the same database for other data in it.
This is where my problem lies. Should/could I use Membership Provider since that is what my users are already using on the other application on the same database this app will be connecting to? Or should I be using Asp.net identity? Can I mix them between applications like that? Should I downgrade my app to use the same MVC version as my older app?
I'm kind of lost as to what path I should take at this point. Any guidance would be greatly appreciated!
Your title says MVC6, but in your question you only talk about MVC5. As far as I'm aware, ASP.NET Membership is completely incompatible with ASP.NET Core (MVC6, although it's no longer called that). However, you can utilize Membership with MVC5. Regardless, ASP.NET Identity is the way forward, so any new application should use that, and updating older apps to move to Identity should, at the very least, be in your pipleline.
Related
I am new to MVC, Have created simple application (very basic, only 1 controller) & used Entity Framework as ORM.
There is form for Registration in application, when I fill up that form user is registered & able to login with those credentials.
But there is no table created in my Database, so my question is where this registration information is stored?
I know this need knowledge of May be Membership/forms authentication, but I don't know them also.
I tried to search google for this, but may be I am not able to predict what to search.
EDIT :
Following is tag of DefaultConnection
Data Source=(LocalDb)\v11.0;AttachDbFilename=|DataDirectory|\aspnet-AKShop-20140808100025.mdf
I think that standard DB was created for your membership. Probably at app_data\aspnetdb.mdf.
Before MVC 5, MembershipProvider or SimpleMembershipProvider by default, and data is persisted in (local) SQL server.
In MVC5, ASP.NET Identity 2.0 by default, and the data is persisted through Entity Framework which by default point to MS SQL, though it is easy to switch the persistence to other DB engines.
Identity 2.0 is quite new, and the official release is April this year, so this is why you got mixed info when searching the Internet. Nevertheless, if you have a green field MVC project, it might be better of to use MVC 5 and Identity 2.0.
I have been given the task of trying to convert our company's existing ASP.NET Web Forms application into an MVC 4 application (as an R&D starting project). I have a little experience with MVC 2, but my issue is trying to actually get started. We have existing stored procedures that we access via Subsonic as our ORM (so that they can be called in our code). We also have a Data Access Layer that is tied in with Subsonic.
I know this is kind of a vauge question, but is there a known way I can use our existing stored procs and tables with a different ORM (such as NHibernate or something) to start creating this MVC application?
Thanks for any help provided.
There should be no reason that the SP's need to change just because the ORM changes; you may want to to improve some of what you are doing and rewrite some of them, but not because the ORM changed.
I have created a custom MVC Forum application. But I'm starting to think that although it works great as is, I'm going to need to get it to work within other MVC apps (In fact I have actually been asked that already).
What is the best way with an MVC app to structure/develop to make it as easy as possible to integrate into an existing MVC application?
Areas? Develop within a sub folder from the start? Or is it just you have to work through and merge configs/controller clashes if necessary.
No need to Config or ... . you only need to create ability in your Logon Model and it's Controllers. A complete example is in Asp.net MVC 4 which Microsoft has added more libraries for authenticate from other sites/profiles. Also the model has changed a few in properties. see this technology or download MVC 4 framework to learn it. it's easy.
I try to use OpenId in ASP.NET MVC4, SO I use This Tutorial, And as you see in Database Structure we need some additional tables to support OpenId and OpenAuth, as usual I use
C:\Windows\Microsoft.NET\Framework64\aspnet_regsql.exe
to implement Membership Database,
I install Visual Studio 2012 with .NETFramework 4.5 and MVC 4 so I run the aspnet_regsql.exe but the created database is not contain additional tables to support OpenId, So is there another way to implement this Database? Or I should add additional database by my own? and if yes how implement needed membership structure in Code side?
I think there must be an auto way (like before) to implement membership to support new OpenId feature, what is your suggestion?
By default, MVC 4 does not use the old membership tables, but rather a new membership system called SimpleMembership that has a very different table structure. You don't use aspnet_regsql, but rather let SimpleMembership create the tables automatically.
If you generate a default internet application with MVC 4, it creates all the code necessary to enable openid and openauth. This is built into the default sample. The example you linked to is for the Universal providers. They too, by the way, have a different table structure than the old SqlMembership system.
How would you handle membership in an ASP.NET MVC application? Using any external libraries? How would you do OpenID log in? username log in? email log in? any other that is worth looking into? Maybe all of them mixed into the application?
It seems ASP.NET comes with some pre-build user database (I'm totally new to .Net). The NerdDinner example uses it but then it makes the foreign keys use the username. That doesn't sound very good. Do you use this schema of two separate databases or only one? What do you use as the foreign key, any IDs?
I've found ASP.Net MVC Membership, anybody using it? does it work well? can it be expected to be maintained?
Membership Providers are not new to ASP.Net MVC, they were introduced with ASP.Net 2.0.
The Membership Provider model is simply an abstraction layer between your application and whatever source you are authenticating your users against. You can switch providers easily by simply changing your web.config file.
It is easy to write a membership provider, there are many walkthroughs on the web. Typically you would do so if you were using a database that used a different schema than the default examples that come with ASP.Net (which is most of the time). The foreign keys on the username thing in the NerdDinner example is a simplistic example that you would rarely see on any real-world databases.
I would highly recommend using the Membership model. Controls like the Login control are built to make use of it, and it is well-designed and makes it easy to change or combine different login methods for your application. If you want to use OpenID, a quick google search brought up this OpenID Membership Provider.