From the course: Learning ASP.NET

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Introduction to Web Pages

Introduction to Web Pages

From the course: Learning ASP.NET

Start my 1-month free trial

Introduction to Web Pages

- [Narrator] Web Pages are another framework offered by ASP.NET. They give you the ability to add dynamic code to HTML pages. They're designed for people already familiar with HTML but want a simple way to add in server processing. At a basic level, Web Pages are just standard HTML files with server-side code in them. That code is written in C# or VB.NET using a markup syntax called Razor. Razor pages written in C# end in .cshtml, and VB.NET pages have the extension .vbhtml. You can do anything you'd normally be able to do in an HTML page, like add JavaScript or jQuery. Let's take a closer look at the syntax for Razor with C# as our server-side language. When you embed a Razor code block into HTML, it has to be enclosed in the @ symbol and curly braces. You can have a single statement of code like this where I'm declaring a variable, or multiple statements within a code block. You can embed any programming language that your page needs like if-else conditional statements or for loops.…

Contents