```html ASP.NET Core MVC - Getting Started - Views

ASP.NET Core MVC - Getting Started - Views

Understanding Views

In ASP.NET Core MVC, a view is a file that defines the presentation layer of your application. It's responsible for rendering the HTML that the user sees in their browser.

Views are typically located in the Views folder within your project. They are usually named with the extension .cshtml.

View Components

You can also use View Components in ASP.NET Core MVC, which provide reusable fragments of view code that can be used in multiple views.

Razor Syntax

ASP.NET Core MVC uses Razor syntax to combine HTML with C# code. You can embed C# code directly into your views using the @ symbol.

@model
@using (var context = ViewContext)
{
// Code to render the view
}

Example View

Here's a simple example of a view:


@model MyWebApp.Models.Product

@model.Name

Price: @model.Price

Next Steps

```