Password storing and validation

This is the last, 3rd part of the series of posts about Authentication and authorization in MVC5 - a practical example on implementation of log in module in MVC application. See the part 1 and part 2 first. You can find the source code here: https://github.com/AgnieszkaMikolajczyk/MyAuth.git It includes scripts for two db tables. The solution uses EDM so to … Continue reading Password storing and validation

Authentication

This is the 2nd part of the series of posts about Authentication and authorization in MVC5 – a practical example on implementation of login module in MVC application. See the part 1 first. You can find the source code here: https://github.com/AgnieszkaMikolajczyk/MyAuth.git It includes scripts for two db tables. The solution uses EDM so to make it work you want to create a simple … Continue reading Authentication

Authorization

This is the 1st part of the series of posts about Authentication and authorization in MVC5 – a practical example on implementation of login module in MVC application. You can find the source code here: https://github.com/AgnieszkaMikolajczyk/MyAuth.git It includes scripts for two db tables. The solution uses EDM so to make it work you want to create a simple database first and … Continue reading Authorization

Html helpers

A helper is a reusable snippet of Razor syntax exposed as a method. It allows you to separate repeating fragments of the page. It renders HTML to the browser - the return type for a helper is HelperResult. Custom helpers To create your own helper, create a folder called App_Code in the root of your … Continue reading Html helpers

MVC View common layouts

Common layouts You can define a layout that is common to several views as a .cshtml file. You can also divide your template to contain header, footer etc. Use RenderSection and pass the section name as the first parameter and boolean value indicating if the section is required. Let's create CommonLayout.cshtml file like this: Then … Continue reading MVC View common layouts

Razor rendering engine

Razor Razor syntax was introduced with MVC 3 (Visual Studio 2010). In Razor view you can write a mix of HTML tags and server side code. You can use C# to write server side code inside Razor view. Razor uses @ character for server side code instead of traditional <% %>.  The syntax is simpler - … Continue reading Razor rendering engine

MVC Controllers

The job of most controllers is to assemble a model that has put some data together, call some services, repositories, data access layer, put this data together and prepare for the view to display. The convention that MVC Framework uses is that a class of the controller Home will be called HomeController (not just Home). It also … Continue reading MVC Controllers

MVC

Separation of concerns Model-View-Controller is a software architectural pattern that divides the application into three interconnected parts to separate internal representation of information from the ways information is presented and accepted from the user. View is responsible for rendering the UI. The views generally do not have logic inside them. Generally a view only needs to know where … Continue reading MVC

Abstract factory and creating controllers

Abstract Factory that creates controllers All custom controllers derive from the Controller abstract base class which implements IController interface. Take a look at the object browser view: What is interesting here, is that this interface comes with an abstract factory called IControllerFactory. This factory uses CreateController method which does what? Yes, you guessed right 😉 … Continue reading Abstract factory and creating controllers