ASP.NET is Microsoft's original, Windows-only web application framework, built on the classic .NET Framework and predating the cross-platform ASP.NET Core rewrite. It's the #12 most-used web framework overall, reported in roughly 14.2% of developer surveys โ a figure kept high by the large amount of legacy enterprise .NET software still running in production. It's used today mainly to maintain existing systems built before Microsoft's shift to ASP.NET Core.
A classic ASP.NET MVC controller action returns a view or JSON, following the same MVC pattern later carried into ASP.NET Core.
using System.Web.Mvc;
public class ProductsController : Controller
{
public ActionResult Details(int id)
{
var product = ProductRepository.GetById(id);
if (product == null)
return HttpNotFound();
return View(product);
}
[HttpPost]
public JsonResult Create(string name, decimal price)
{
var product = new Product { Name = name, Price = price };
ProductRepository.Save(product);
return Json(new { success = true });
}
}
Create a new ASP.NET MVC project from Visual Studio's project templates, or scaffold one from the .NET Framework CLI template pack on Windows.
:: from Visual Studio: File > New Project > ASP.NET Web Application (.NET Framework)
:: choose the "MVC" template, then build and run with IIS Express
:: or scaffold via CLI template pack
dotnet new mvc -f net48 -o MyLegacyApp