An Introduction To ASP NET Razor Pages

Donations to freeCodeCamp go toward our education initiatives, and help pay for servers, services, and staff. The key difference between Razor Pages implementation of the MVC pattern and ASP.NET Core MVC is that Razor Pages uses the Page Controller pattern instead of the Front Controller pattern. This is reflected in the Solution Explorer, where the Dependencies tree may show NewtonsoftJson and/or EF Core packages nested under the NuGet node, if you use them in your project.

RedirectToPage method is a helper method that comes with PageModel and helps to eliminate the need to write up a new instance of an action result and simplify the code. A new major release of .NET is published every year in November, enabling developers, the community, and businesses to plan their roadmaps. Even numbered releases are LTS releases with free support and patches for three years. razor engine .net core Odd-numbered releases are STS releases with free support and patches for 18 months. Microsoft continued encouraging developers to migrate from .NET Framework to .NET Core and the subsequent .NET 5+ versions to take advantage of the benefits mentioned above. These ASP.NET Core Tutorials are designed for Beginners and Professional Developers who want to learn ASP.NET Core step by step.

ASP.NET Core MVC – Data Passing Techniques

In this ASP.NET Core Tutorials series, I will discuss all the basic, intermediate, and advanced concepts of ASP.NET Core (.NET 6). These ASP.NET Core tutorials will help you to build rich data-driven web applications. At the end of these ASP.NET Core Tutorials, you will be better positioned to perform all the CRUD (i.e., Create, Read, Update, and Delete) operations using the SQL Server database. You will learn ASP.NET Core basics, ASP.NET Core Razor Pages, ASP.NET Core MVC, Blazor, Entity Framework Core, and ASP.NET Core Web API. You can still choose to use ASP.NET Core MVC to build your ASP.NET Core web applications.

  • This is reflected in the Solution Explorer, where the Dependencies tree may show NewtonsoftJson and/or EF Core packages nested under the NuGet node, if you use them in your project.
  • In both cases, learning C# as a language and ASP.NET Core as a framework will tick those boxes.
  • This site is dedicated to helping developers who want to use the ASP.NET Razor Pages web development framework to build web applications.
  • To differentiate from the ۲۰۱۹ series, the 2020 series will mostly focus on a growing single codebase (NetLearner!) instead of new unrelated code snippets week.
  • RedirectToPage method returns a new instance of RedirectToPageResult (a form of ActionResult).

It was designed to build modern, high-performance, and scalable applications that could run on Windows, macOS, and Linux. Razor Pages is included within .NET Core from version 2.0 onwards, which is available as a free download as either an SDK (Software Development Kit) or a Runtime. The SDK includes the runtime and command line tools for creating .NET Core applications. The SDK is installed for you when you install Visual Studio 2017 Update 3 or later. The Runtime-only installation is intended for use on machines where no development takes place. Built on top of MVC in ASP .NET Core, Razor Pages allows you to simplify the way you organize and code your web apps.

Page Parameters

Razor Pages is suitable for all kinds of developers from beginners to enterprise level. Other features are provided as NuGet Packages, which you can add to your application as needed. In this way, the .NET Core application speeds up the performance, reduces the memory footprint, and becomes easy to maintain. Part of the ASP.NET Core web development framework from Microsoft, Razor Pages supports cross platform development and can be deployed to Windows, Unix and Mac operating systems.

Page parameters can be included with the @page directive at the top of the page. You may also couple the parameter names with a data type, e.g. int for integers. To use the Model’s properties, you can use the syntax Model.Property to refer to each property by name.