There is an issue in the Identity framework when the business requirements need a developer to interact with the roles that a user is assigned to as soon as the user object is created upon successful login. The Identity framework has a bug that has been posted online numerous times but is hard to identify through all of the other code that users post. Luckily there is a very easy fix for it.
Depending on the application there may be times that it is desirable or required to add a user to a role immediately when they register. Other times you may want to add users to various roles depending on what privileges you want them to have. This is very easily accomplished in the Register method of the AccountController. This is the third post in a 3 part series on extending the ASP.NET Identity Framework.
As stated in the previous blog post Identity is very useful for Asp.net developers out of the box. There is some functionality that must be configured to make it completely functional. User can register and they will be redirected to a default page that asks them to check and confirm their email. The system is not setup however to email the confirmation message nor is it configured to lock users out until they confirm their email. This takes a little configuration but I take it a step further to make it as user friendly as possible. This is the second post in a 3 part series on extending the ASP.NET Identity Framework.
The Identity framework is a great tool that allows asp.net developers to easily add authentication to their applications. It is functional with limited capabilities out of the box but I like to do some additional configuration to make it fully functional for the way that I work. This is the first post in a 3 part series on extending the ASP.NET Identity Framework.
I have found myself returning to past projects looking up code that I had done previously so that I did not have to figure it out again. Many times it is for larger sections of code that I have to use on a regular basis. Having to dig through multiple solutions to find the code that I am looking for becomes a pain after a while. Visual Studio has the ability to store code snippets but those snippets don’t always carry over from solution to solution. I began looking into snippet managers and found some very promising options.
I wanted to display a list of records grouped by category. There were numerous ways that people were doing it online, many of which were overly difficult and/or did not work. Ultimately it simply comes down to a simple Linq statement in the controller with the appropriate @model statement on the view.
The beauty of ASP.NET MVC is its ability to leverage so many other frameworks to help improve code security, maintainability and SOLID development principles. One downfall however is that these different frameworks don’t always want to work together out of the box at times such as Identity for authentication and authorization and Unity for dependency injection. This is not very difficult to fix as long as you know what you need to add where. Continue reading