Here's a funny one - I suspect because I am using VS 2010 with MVC4.
Created an MVC4 App using the internet template. I get AccountController.cs and the basic pages allow me to register and add users. So far so good. However, the ASP.NET configuration tool (from Project menu) seems to be using a different database.
Web.config has this:
but my MVC project also has a ASPNETDB.MDF inside app_data. ASP.NET configuration tool seems to be using ASPNETDB.MDF, but run time seems to be using the one referenced by DefaultConnection.
Also, after doing some research on here and elsewhere, other people's Web.Config seem to have lots of entries for providers etc. which I don't have. Am I missing some update / NuGet package?
All I want to do is use MVC4 with users and roles, and was planning to use the configuration tool to setup the predefined roles and some basic users.
Thanks in advance,
Ray
Related
When one creates a new server-side Blazor project, you actually get two projects within a solution. Why is this? I suppose it has something to do with the architecture as shown in this diagram from the docs? So in other words, a .NET core process must be used to host the Blazor app. Is that the basic idea? In other words, IIS would serve up the .NET core app, which in turn "serves" up the Blazor app, or something to that effect?
According to "ASP.NET Core updates in .NET Core 3.0 Preview 2" blog article...
https://blogs.msdn.microsoft.com/webdev/2019/01/29/aspnet-core-3-preview-2/
Why two projects? In part it's to separate the UI logic from the rest of the application. There is also a technical limitation in this preview that we are using the same Razor file extension (.cshtml) for Razor Components that we also use for Razor Pages and Views, but they have different compilation models, so they need to kept separate. In a future preview we plan to introduce a new file extension for Razor Components (.razor) so that you can easily host your components, pages, and views all in the same project.
Is there any opensource project for managing users, roles etc for Asp.net Core Identity? Something similar to what was there for the old Asp.Net Membership.
You are looking for Identity Manager. But last time I looked on it (some time ago now), it had to be installed as a separate project, independent from your main application. Though this might have changed now.
In addition to the project wiki, here is a write-up about this project - you can start from there.
I created a MVC 4 project using MS Visual Web Developer 2010 Express. It by default uses "SimpleMembership" and it connects to a database (A) on my local SQL Server. I ran the web project and registered a trial user, and it was successful. When I checked the database A with Management Studio, the user was there.
However, when I turned on debug and opened the ASP.NET Web Application Administration Web Tool. It showed User: 0. Obviously the Admin Tool did not check the database A. Then I was able to create another user via the Admin Tool. Surprisingly it was found added to the "aspnetdb.mdf" in "App_Data" folder of my project.
My questions are:
how I can make the Admin Tool connect to the database A on my SQL Server instead of the "aspnetdb.mdf" file as I don't want to store my user profiles in two separate places.
Why "aspnetdb.mdf" uses ASP.Net Membership instead of "SimpleMembership"?
Thanks!
The Web Application Administration Tool was developed for SimpleMembership's predecessor ASP.NET Membership. When Microsoft released SimpleMembership they never bothered to provide support for any admin tool; you have to create one yourself. Take a look at this QA which explains in more detail.
Be aware that Microsoft has dropped SimpleMembership in MVC 5 for ASP.NET Identity. ASP.NET Identity is a much better solution, but it still does not come with an admin tool. I would move to ASP.NET Identity if possible. Here is an article on how to migrate to ASP.NET Identity.
I have recently upgraded my MVC3 application to MVC4 successfully. In my old MVC3 application, I had a custom membership provider written to read/write user details, into custom tables within a Sql Server database. The upgraded MVC4 application works perfectly well with the custom membership provider.
I now want to allow my users to login through Active Directory and/or social media (including facebook and google). My question is: What would be the best way to accomplish this? Should I scrap my old custom membership provider and write a new one that implements SimpleMembershipProvider instead? Or is there another more efficient, better way to accomplish this?
I still need to keep my custom tables, since it holds required user/role information and is also referenced by other tables in my application for user-specific data.
Thank You
I think you will find it difficult to mold SimpleMembership to fit your existing membership database and it is being deprecated for ASP.NET Identity. If you are going through the upgrade process now keep going to MVC 5 and use ASP.NET Identity. It is much more extensible in it's architecture and support OAuth with plugins for the major social media sites.
I currently have a MVC 4 app with SimpleMembership, which works well. I feelt though that I might as well update now to MVC 5, while I am still developing rather than later.
I am wondering if it would be more practical to stay with SimpleMembership or move to ASP Identity. I have read that it is possible to get SimpleMembership to work. Link
I would have no problem moving to ASP Identity if I hadn't read that it forced the developer to implement most of the features older versions had themselves. Such as Login Attempts and Confirming Email. Here is one place this is stated
There may have been changes to ASP Identity since these posts, but I have a hard time finding documentation on it.
Any advice or personal experiences would be highly appreciated.
The open-source SimpleSecurity Project provides good examples on implementing features such as email confirmation using ASP.NET Identity. This project also provides an example of using SimpleMembership in MVC 5 and helps you through some of the hurdles I hit when trying to upgrade to MVC 5. The implementation of ASP.NET Identity in the SimpleSecurity project decouples it from the web application and provides an API similar to the WebSecurity class you are familiar with from using SimpleMembership. SimpleSecurity gives you both options with MVC 5, but since you are making the effort to upgrade to MVC 5 and you are still in development I would also make the effort to upgrade to ASP.NET Identity as this is the future of identity and access control in ASP.NET.