PRO 30% Free • Stripe ($15) & Razorpay (₹899)

What is ASP.NET Razor Pages?

Top Course Staff · 3 min read · Web development · PRO · 30% Free Preview Available

What is ASP.NET Razor Pages?

According to Microsoft, the makers of the software, ASP.NET is: “anopen sourceweb framework…for building modern web apps and services with.NET.”

If you’re not familiar with .NET, then start withthis article on the .NET platform. In short, .NET is the engine that lets you build programs with C# (and a few other languages).

So, ASP.NET is something that goes on top of .NET to build a specific type of program: web apps and services. “Web apps” and “web services” are involved in nearly everything that you encounter on the internet. Web sites, e-mail, downloading an app on your phone, anything that deals withHTTP requestsand responses — those all use some kind ofweb appor web service. This article focuses on using ASP.NET to build websites, which we’ll also call web apps (there’s a difference, but we won’t get into it now).

Let’s say we want to build a web app of our own. We can choose nearly anyprogramminglanguage, but let’s say we pick C#. If we build a program with C#, we’ll probably use the .NET platform. Since our program is a web app, we’ll use ASP.NET!

If you’d like more details, here are some of the tools included in ASP.NET:

  • A base framework for processing web requests in C# or F#
  • A front-end syntax, known as Razor, for building dynamic web pages using C#
  • Libraries for common web patterns, such asModel View Controller (MVC)
  • Authentication system that includes libraries, a database, and template pages for handling logins
  • Editor extensions to provide syntax highlighting, code completion, and other functionality specifically for developing web pages

Using ASP.NET, you can build web apps in a number of different ways — the same way a “flying machine” can be built as a jet plane or a helicopter, or a “floor-cleaning machine” can be built as a broom or a vacuum. We call these different waysarchitecturesorpatterns. We’ll focus on one: the Razor Pages architecture.

The Razor Pages architecture goes like this: Every page of our website is represented by two files:

  • Aview page, that displays information, and
  • Apage model, which handles the accessing and processing of information.

For example, say that you have a bakery website that handles online orders. When users visit the site, they see a page containing a menu and a form to input an order. The way that the menu and form are displayed is defined in the view page. How the menu is accessed and how the order is handled are defined in the corresponding page model.

Razor Pages can also be used to make things other than web pages, like APIs and microservices. (Remember when Microsoft said ASP.NET is good for web apps AND services?) In those cases we wouldn’t need a view page, we’d just use page models.

Let’s recap:

  • To build programs with C#, you need the .NET platform
  • To build programs like web apps and web services, you need the ASP.NET framework
  • ASP.NET provides a number of ways to build web apps/services. We focused on one called Razor Pages, which uses a page-focused (View Page + Page Model) pattern.

Now you know the tools; it’s time to get building!

'The Codecademy Team, composed of experienced educators and tech experts, is dedicated to making tech skills accessible to all. We empower learners worldwide with expert-reviewed content that develops and enhances the technical skills needed to advance and succeed in their careers.'

30% Free Preview Reached · Unlock Remaining 70%

Complete Payment to Unlock Full Guide & Source Code

You are viewing the 30% preview. Join TopCourseAI Pro to unlock the remaining 70% of this article, unblur all code snippets, and gain full access to all 412 technical projects and guides.

✓ Full Access to All 160+ Projects
✓ Instant Blur Removal Everywhere
✓ Production Source Code & Blueprints
✓ All Future Deep Dives Included
Instant Unhindered Activation ·
End of Preview · Unlock Complete Blueprint & Source Code

Ready to access the complete step-by-step tutorial?

Gain full unhindered access to all 412 technical projects and guides, unblur all source code snippets, and download runnable scripts.

Production AI Blueprints

Ready to build production-grade AI systems?

Enjoyed this guide? Continue exploring our library of 166+ production blueprints, multi-agent swarms, and autonomous agent systems with 100% unblurred, executable source code.