AgentStack
SKILL verified MIT Self-run

Razor Pages

skill-ngxtm-devkit-razor-pages · by ngxtm

ASP.NET Core Razor Pages patterns for server-rendered web apps.

No reviews yet
0 installs
18 views
0.0% view→install

Install

$ agentstack add skill-ngxtm-devkit-razor-pages

✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

Are you the author of Razor Pages? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Razor Pages

Priority: P1 (OPERATIONAL)

ASP.NET Core Razor Pages patterns for server-rendered web applications.

Implementation Guidelines

  • PageModel: Keep logic in PageModel, not in .cshtml. Use handlers (OnGet, OnPost).
  • Model Binding: Use [BindProperty] for form data. [FromQuery] for query params.
  • Tag Helpers: Use asp-for, asp-action, asp-route-* for type-safe HTML.
  • Partial Views: Reusable UI components with `` tag helper.
  • View Components: Complex reusable UI with server logic.
  • Layout: Shared layout in _Layout.cshtml. Use sections for page-specific content.
  • TempData: Flash messages with PRG (Post-Redirect-Get) pattern.

Anti-Patterns

  • No logic in .cshtml: Move to PageModel or View Components.
  • No ViewBag/ViewData: Use strongly-typed models.
  • No inline CSS/JS: Use external files with bundling.
  • No form without anti-forgery: Always include @Html.AntiForgeryToken() or use asp-antiforgery.

Code

// Pages/Users/Create.cshtml.cs
public class CreateModel(IUserService userService, ILogger logger) : PageModel
{
    [BindProperty]
    public CreateUserInput Input { get; set; } = new();

    public List Roles { get; set; } = [];

    public async Task OnGetAsync()
    {
        Roles = await GetRolesAsync();
    }

    public async Task OnPostAsync()
    {
        if (!ModelState.IsValid)
        {
            Roles = await GetRolesAsync();
            return Page();
        }

        var result = await userService.CreateAsync(Input);

        if (!result.IsSuccess)
        {
            ModelState.AddModelError(string.Empty, result.Error!);
            Roles = await GetRolesAsync();
            return Page();
        }

        TempData["Success"] = "User created successfully";
        return RedirectToPage("./Index");
    }
}
@* Pages/Users/Create.cshtml *@
@page
@model CreateModel

Create User

@if (TempData["Error"] is string error)
{
    @error
}

    

    
        
        
        
    

    
        
        
        
    

    
        
        
            Select a role
        
        
    

    Create
    Cancel

@section Scripts {
    
}

Reference & Examples

For page conventions, view components, and AJAX patterns: See [references/REFERENCE.md](references/REFERENCE.md).

Related Topics

aspnet-core | blazor | security

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet — be the first.

Versions

  • v0.1.0 Imported from the upstream source.