Introduction to ASP.NET

ASP.NET is a free, cross-platform, open-source framework for building modern web applications and services with .NET.

MVC Pattern

ASP.NET MVC separates application logic into Model, View, and Controller components:

public class HomeController : Controller
{
    public IActionResult Index()
    {
        return View();
    }
}

Razor Syntax

Razor is a markup syntax for embedding server-based code into web pages:

@@{
    var greeting = "Hello, ASP.NET!";
}
<h1>@greeting</h1>

Routing

Configure routes in ASP.NET Core:

app.MapControllerRoute(
    name: "default",
    pattern: "{controller=Home}/{action=Index}/{id?}");