Author: Code Maze

Routing in ASP.NET Core MVC

In this article, we’re going to discuss the routing capabilities in ASP.NET Core MVC. We’re also going to learn how to set up routes in two different ways. If you’ve missed some of the previous articles in the series we recommend visiting the series page: ASP.NET Core MVC Series. To download this article’s source code visit: Routing in ASP.NET Core MVC. We have divided this article into the following sections: Routing in ASP.NET Core MVC Conventional Routing Multiple Routes Attribute Routing Multiple Routes Let’s dive into the material. Routing in ASP.NET Core MVC Routing is the process through which...

Read More

State Management in ASP.NET Core MVC

HTTP is a stateless protocol. HTTP requests are independent messages that don’t retain user values or app state. We need to take additional steps to manage states between the requests. In this article, we are going to look at various approaches to preserve user data and app state between the requests.

Read More

Views, Partial Views, and Layouts in ASP.NET Core MVC

In the MVC pattern, Views handle the application’s data presentation and user interaction. They also help to establish a Separation of Concerns (SoC) within an MVC application by separating the user interface markup from other parts of the application. A view is an HTML template with the embedded Razor markup. It has the .cshtml extension and is based on C#. Razor markup interacts with HTML markup to produce a web page which is then sent to the client. Usually, there are separate view files corresponding to each controller action method and view files are grouped into folders named for...

Read More

Getting Started with ASP.NET Core MVC

In this article, we are going to look at the basics of building an ASP.NET Core MVC web app. We are going to start by creating a simple ASP.NET Core MVC app using the default template provided by Visual Studio. The default template itself will translate into a working app. To the default template, we’re going to add a controller and a few action methods. Afterward, we’re going to introduce the views using the razor syntax and return them from the controller methods. Finally, we’re going to define some models and see how those can be passed into the...

Read More