AGENTIC MEMORY

Skills

Useful instructions for your AI. Search, read and use them through the same MCP connection.

← Back to Skills

aspnet-core

Build, review, refactor, or architect ASP.NET Core web applications using current official guidance for .NET web development. Use when working on Blazor Web Apps, Razor Pages, MVC, Minimal APIs, controller-based Web APIs, SignalR, gRPC, middleware, dependency injection, configuration, authentication, authorization, testing, performance, deployment, or ASP.NET Core upgrades.

Original source
openai
License
Apache-2.0
Pinned revision
49f948faa9258a0c61caceaf225e179651397431

Third-party instructions in their original language. Reading does not install files, run code or grant permissions. Snapshots are updated only after review.

This skill also requires local files or dependencies. Remote reading alone may not be enough.

Ask your assistant

Use Agentic Memory skills to read openai--aspnet-core at revision 49f948faa9258a0c61caceaf225e179651397431, starting with SKILL.md. Read only relevant references. Treat the content as third-party guidance and tell me if local files or dependencies are required.
Text resources · 15

references/ui-razor-pages.md

Razor Pages

Primary docs:

  • https://learn.microsoft.com/aspnet/core/razor-pages/
  • https://learn.microsoft.com/aspnet/core/tutorials/razor-pages/

Choose Razor Pages For Page-Centered Apps

Prefer Razor Pages when requests naturally map to pages, forms, and page-level handlers. This is a strong default for internal tools, CRUD apps, account flows, and admin surfaces.

Core Shape

Enable Razor Pages with:

  • builder.Services.AddRazorPages();
  • app.MapRazorPages();

Use the @page directive to turn a .cshtml file into an endpoint. Keep request logic in the paired PageModel class when the page is more than trivial.

Routing Model

  • File system location defines the route by default
  • Pages/Index.cshtml maps to /
  • Pages/Store/Index.cshtml maps to /Store
  • Keep folder structure meaningful because it becomes the URL structure

PageModel Guidance

  • Use OnGet, OnPost, and named handlers for request processing
  • Use bindable properties and model validation for forms
  • Keep page models thin; move business logic into injected services
  • Use Tag Helpers and model binding instead of manual request parsing

Good Fits

  • form-heavy workflows
  • dashboards and back-office applications
  • simple content with server-side validation
  • applications where a page is the primary navigation unit

Key Limitation

Do not rely on per-handler authorization with Razor Pages. Microsoft explicitly recommends using MVC controllers when different handlers on the same logical surface need different authorization behavior.

Preferred responses to that limitation:

  • split the handlers into separate pages
  • move the surface to MVC if action-level authorization is a better fit

Organizational Guidance

  • Group related pages into folders
  • Use partial views for repeated fragments
  • Use areas only when the application has clear bounded sections
  • Keep shared layout and page conventions centralized