[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-dotnet-configure-auth":3,"mdc-mcgfro-key":37,"related-repo-dotnet-configure-auth":1553,"related-org-dotnet-configure-auth":1661},{"slug":4,"name":4,"fn":5,"description":6,"org":7,"tags":11,"stars":25,"repoUrl":26,"updatedAt":27,"license":28,"forks":29,"topics":30,"repo":32,"sourceUrl":35,"mdContent":36},"configure-auth","integrate authentication in Blazor apps","Add authentication and authorization to a Blazor Web App, accounting for the app's render mode. USE WHEN the user needs [Authorize] on pages, AuthorizeView, role or policy-based access, login\u002Flogout Identity pages, or AuthenticationStateProvider. Also USE WHEN auth state is null after WebAssembly loads, SignInManager throws in an interactive component, \u003CNotAuthorized> content never renders in static SSR, or HttpContext.User is null in an interactive component. DO NOT USE for general component authoring (see author-component), for prerendering concerns unrelated to auth (see support-prerendering), or for managing non-auth cascading state (see coordinate-components).\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},"dotnet",".NET (Microsoft)","https:\u002F\u002Fpexgzepcugksgbtrxkhf.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Forg-logos\u002Fdotnet.png",[12,16,19,22],{"name":13,"slug":14,"type":15},"Auth","auth","tag",{"name":17,"slug":18,"type":15},".NET","net",{"name":20,"slug":21,"type":15},"ASP.NET Core","asp-net-core",{"name":23,"slug":24,"type":15},"Blazor","blazor",4576,"https:\u002F\u002Fgithub.com\u002Fdotnet\u002Fskills","2026-07-12T08:23:08.579377","MIT",332,[31],"agent-skills",{"repoUrl":26,"stars":25,"forks":29,"topics":33,"description":34},[31],"Repository for skills to assist AI coding agents with .NET and C#","https:\u002F\u002Fgithub.com\u002Fdotnet\u002Fskills\u002Ftree\u002FHEAD\u002Fplugins\u002Fdotnet-blazor\u002Fskills\u002Fconfigure-auth","---\nlicense: MIT\nname: configure-auth\ndescription: >\n  Add authentication and authorization to a Blazor Web App, accounting for the app's render mode.\n  USE WHEN the user needs [Authorize] on pages, AuthorizeView, role or policy-based access,\n  login\u002Flogout Identity pages, or AuthenticationStateProvider.\n  Also USE WHEN auth state is null after WebAssembly loads, SignInManager throws in an interactive\n  component, \u003CNotAuthorized> content never renders in static SSR, or HttpContext.User is null in\n  an interactive component.\n  DO NOT USE for general component authoring (see author-component), for prerendering concerns\n  unrelated to auth (see support-prerendering), or for managing non-auth cascading state\n  (see coordinate-components).\n---\n\n# Configure Auth\n\n## Step 1 — Read AGENTS.md\n\nRead `AGENTS.md` at the workspace root for the project's interactivity mode and scope before making changes.\n\n## Step 2 — Register auth services in Program.cs\n\n```csharp\n\u002F\u002F Program.cs (server project)\nbuilder.Services.AddCascadingAuthenticationState();\nbuilder.Services.AddAuthorization();\n```\n\nFor ASP.NET Core Identity add the Identity services:\n\n```csharp\nbuilder.Services.AddAuthentication(options =>\n{\n    options.DefaultScheme = IdentityConstants.ApplicationScheme;\n    options.DefaultSignInScheme = IdentityConstants.ExternalScheme;\n})\n.AddIdentityCookies();\n\nbuilder.Services.AddIdentityCore\u003CApplicationUser>()\n    .AddRoles\u003CIdentityRole>()\n    .AddEntityFrameworkStores\u003CApplicationDbContext>()\n    .AddSignInManager()\n    .AddDefaultTokenProviders();\n```\n\n## Step 3 — Wire App.razor for auth and render mode\n\nThe `App.razor` component must use `AuthorizeRouteView` and conditionally apply the render mode so that pages excluded from interactive routing render statically.\n\n```razor\n\u003C!DOCTYPE html>\n\u003Chtml>\n\u003Chead>\n    \u003CHeadOutlet @rendermode=\"RenderModeForPage\" \u002F>\n\u003C\u002Fhead>\n\u003Cbody>\n    \u003CRoutes @rendermode=\"RenderModeForPage\" \u002F>\n    \u003Cscript src=\"_framework\u002Fblazor.web.js\">\u003C\u002Fscript>\n\u003C\u002Fbody>\n\u003C\u002Fhtml>\n\n@code {\n    [CascadingParameter]\n    public HttpContext HttpContext { get; set; } = default!;\n\n    private IComponentRenderMode? RenderModeForPage =>\n        HttpContext.AcceptsInteractiveRouting()\n            ? InteractiveServer   \u002F\u002F replace with the app's render mode\n            : null;\n}\n```\n\nIn `Routes.razor` (or wherever the router lives), use `AuthorizeRouteView`:\n\n```razor\n\u003CRouter AppAssembly=\"typeof(Program).Assembly\">\n    \u003CFound Context=\"routeData\">\n        \u003CAuthorizeRouteView RouteData=\"routeData\"\n                            DefaultLayout=\"typeof(Layout.MainLayout)\">\n            \u003CNotAuthorized>\n                @if (context.User.Identity?.IsAuthenticated != true)\n                {\n                    \u003CRedirectToLogin \u002F>\n                }\n                else\n                {\n                    \u003Cp>You are not authorized to access this resource.\u003C\u002Fp>\n                }\n            \u003C\u002FNotAuthorized>\n        \u003C\u002FAuthorizeRouteView>\n        \u003CFocusOnNavigate RouteData=\"routeData\" Selector=\"h1\" \u002F>\n    \u003C\u002FFound>\n\u003C\u002FRouter>\n```\n\n## Step 4 — Protect pages and components\n\n### [Authorize] attribute on pages\n\n```razor\n@page \"\u002Fadmin\"\n@attribute [Authorize]\n```\n\nWith roles or policies:\n\n```razor\n@attribute [Authorize(Roles = \"Admin\")]\n@attribute [Authorize(Policy = \"RequireManager\")]\n```\n\n### AuthorizeView for conditional UI\n\n```razor\n\u003CAuthorizeView>\n    \u003CAuthorized>Welcome, @context.User.Identity?.Name!\u003C\u002FAuthorized>\n    \u003CNotAuthorized>\u003Ca href=\"Account\u002FLogin\">Log in\u003C\u002Fa>\u003C\u002FNotAuthorized>\n\u003C\u002FAuthorizeView>\n```\n\nRole\u002Fpolicy variants:\n\n```razor\n\u003CAuthorizeView Roles=\"Admin,Manager\">\n    \u003CAuthorized>Admin content here\u003C\u002FAuthorized>\n\u003C\u002FAuthorizeView>\n```\n\n### Access auth state in code\n\n```csharp\n[CascadingParameter]\nprivate Task\u003CAuthenticationState>? AuthState { get; set; }\n\nprotected override async Task OnInitializedAsync()\n{\n    if (AuthState is not null)\n    {\n        var state = await AuthState;\n        var isAdmin = state.User.IsInRole(\"Admin\");\n    }\n}\n```\n\n## Step 5 — Identity pages must stay static SSR\n\n`SignInManager` and `UserManager` use `HttpContext` internally and **throw in interactive components**. Identity pages (login, register, manage) must render as static SSR.\n\nIn a **globally interactive** app, mark every Identity page:\n\n```razor\n@page \"\u002FAccount\u002FLogin\"\n@attribute [ExcludeFromInteractiveRouting]\n```\n\nThis forces a full-page navigation (exits the interactive circuit) so the page renders through the static SSR pipeline with a real `HttpContext`.\n\n`App.razor` must use `AcceptsInteractiveRouting()` (Step 3) to return `null` for these pages — otherwise the framework still tries to render them interactively.\n\nIn a **per-page** app, Identity pages are static by default (no `@rendermode` directive), so `[ExcludeFromInteractiveRouting]` is not needed.\n\n## Step 6 — Auth state in WebAssembly \u002F Auto mode\n\nWebAssembly components run in the browser and have no `HttpContext`. Auth state must be serialized from the server during prerendering and deserialized on the client.\n\n**Server `Program.cs`:**\n\n```csharp\nbuilder.Services.AddAuthenticationStateSerialization();\n```\n\n**Client `.Client\u002FProgram.cs`:**\n\n```csharp\nbuilder.Services.AddAuthenticationStateDeserialization();\n```\n\nWithout these calls, `Task\u003CAuthenticationState>` resolves to an anonymous user after WebAssembly takes over from prerendering.\n\n`AddAuthenticationStateSerialization` accepts options to include role and claim data:\n\n```csharp\nbuilder.Services.AddAuthenticationStateSerialization(options =>\n    options.SerializeAllClaims = true);\n```\n\n## Render Mode × Auth Matrix\n\n| Render mode | HttpContext.User | SignInManager | Auth state source | Key requirement |\n|---|---|---|---|---|\n| Static SSR | Available | Works | Server pipeline | Use middleware for redirects, `\u003CNotAuthorized>` does NOT render |\n| Server (interactive) | NOT available | Throws | `CascadingAuthenticationState` | Use `[Authorize]` + `AuthorizeView`, not `HttpContext` |\n| WebAssembly | NOT available | Throws | Serialized from server | `AddAuthenticationStateSerialization` \u002F `Deserialization` |\n| Auto | NOT available after WASM | Throws | Serialized from server | Same as WebAssembly; register in **both** Program.cs files |\n\n## Common Mistakes\n\n| Mistake | Symptom | Fix |\n|---------|---------|-----|\n| Using `HttpContext.User` in interactive component | Null or stale claims | Use `[CascadingParameter] Task\u003CAuthenticationState>` |\n| `SignInManager` in interactive component | `InvalidOperationException` | Move to static SSR page with `[ExcludeFromInteractiveRouting]` |\n| Missing `AddAuthenticationStateSerialization` | Anonymous user after WASM loads | Add to server Program.cs; add `Deserialization` to client Program.cs |\n| `\u003CNotAuthorized>` in static SSR layout | Content never shown | Static SSR uses middleware pipeline; redirect via `LoginPath` or `RedirectToLogin` component |\n| Global interactivity without `AcceptsInteractiveRouting` | Identity pages crash | Add `AcceptsInteractiveRouting()` check in App.razor (Step 3) |\n| Missing `AddCascadingAuthenticationState()` | `Task\u003CAuthenticationState>` is null | Register in Program.cs (Step 2) |\n",{"data":38,"body":39},{"license":28,"name":4,"description":6},{"type":40,"children":41},"root",[42,50,57,72,78,118,123,236,242,263,438,458,607,613,625,648,653,676,682,721,726,756,762,854,860,895,907,930,942,968,995,1001,1013,1028,1042,1057,1071,1084,1095,1118,1124,1325,1331,1547],{"type":43,"tag":44,"props":45,"children":46},"element","h1",{"id":4},[47],{"type":48,"value":49},"text","Configure Auth",{"type":43,"tag":51,"props":52,"children":54},"h2",{"id":53},"step-1-read-agentsmd",[55],{"type":48,"value":56},"Step 1 — Read AGENTS.md",{"type":43,"tag":58,"props":59,"children":60},"p",{},[61,63,70],{"type":48,"value":62},"Read ",{"type":43,"tag":64,"props":65,"children":67},"code",{"className":66},[],[68],{"type":48,"value":69},"AGENTS.md",{"type":48,"value":71}," at the workspace root for the project's interactivity mode and scope before making changes.",{"type":43,"tag":51,"props":73,"children":75},{"id":74},"step-2-register-auth-services-in-programcs",[76],{"type":48,"value":77},"Step 2 — Register auth services in Program.cs",{"type":43,"tag":79,"props":80,"children":85},"pre",{"className":81,"code":82,"language":83,"meta":84,"style":84},"language-csharp shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","\u002F\u002F Program.cs (server project)\nbuilder.Services.AddCascadingAuthenticationState();\nbuilder.Services.AddAuthorization();\n","csharp","",[86],{"type":43,"tag":64,"props":87,"children":88},{"__ignoreMap":84},[89,100,109],{"type":43,"tag":90,"props":91,"children":94},"span",{"class":92,"line":93},"line",1,[95],{"type":43,"tag":90,"props":96,"children":97},{},[98],{"type":48,"value":99},"\u002F\u002F Program.cs (server project)\n",{"type":43,"tag":90,"props":101,"children":103},{"class":92,"line":102},2,[104],{"type":43,"tag":90,"props":105,"children":106},{},[107],{"type":48,"value":108},"builder.Services.AddCascadingAuthenticationState();\n",{"type":43,"tag":90,"props":110,"children":112},{"class":92,"line":111},3,[113],{"type":43,"tag":90,"props":114,"children":115},{},[116],{"type":48,"value":117},"builder.Services.AddAuthorization();\n",{"type":43,"tag":58,"props":119,"children":120},{},[121],{"type":48,"value":122},"For ASP.NET Core Identity add the Identity services:",{"type":43,"tag":79,"props":124,"children":126},{"className":81,"code":125,"language":83,"meta":84,"style":84},"builder.Services.AddAuthentication(options =>\n{\n    options.DefaultScheme = IdentityConstants.ApplicationScheme;\n    options.DefaultSignInScheme = IdentityConstants.ExternalScheme;\n})\n.AddIdentityCookies();\n\nbuilder.Services.AddIdentityCore\u003CApplicationUser>()\n    .AddRoles\u003CIdentityRole>()\n    .AddEntityFrameworkStores\u003CApplicationDbContext>()\n    .AddSignInManager()\n    .AddDefaultTokenProviders();\n",[127],{"type":43,"tag":64,"props":128,"children":129},{"__ignoreMap":84},[130,138,146,154,163,172,181,191,200,209,218,227],{"type":43,"tag":90,"props":131,"children":132},{"class":92,"line":93},[133],{"type":43,"tag":90,"props":134,"children":135},{},[136],{"type":48,"value":137},"builder.Services.AddAuthentication(options =>\n",{"type":43,"tag":90,"props":139,"children":140},{"class":92,"line":102},[141],{"type":43,"tag":90,"props":142,"children":143},{},[144],{"type":48,"value":145},"{\n",{"type":43,"tag":90,"props":147,"children":148},{"class":92,"line":111},[149],{"type":43,"tag":90,"props":150,"children":151},{},[152],{"type":48,"value":153},"    options.DefaultScheme = IdentityConstants.ApplicationScheme;\n",{"type":43,"tag":90,"props":155,"children":157},{"class":92,"line":156},4,[158],{"type":43,"tag":90,"props":159,"children":160},{},[161],{"type":48,"value":162},"    options.DefaultSignInScheme = IdentityConstants.ExternalScheme;\n",{"type":43,"tag":90,"props":164,"children":166},{"class":92,"line":165},5,[167],{"type":43,"tag":90,"props":168,"children":169},{},[170],{"type":48,"value":171},"})\n",{"type":43,"tag":90,"props":173,"children":175},{"class":92,"line":174},6,[176],{"type":43,"tag":90,"props":177,"children":178},{},[179],{"type":48,"value":180},".AddIdentityCookies();\n",{"type":43,"tag":90,"props":182,"children":184},{"class":92,"line":183},7,[185],{"type":43,"tag":90,"props":186,"children":188},{"emptyLinePlaceholder":187},true,[189],{"type":48,"value":190},"\n",{"type":43,"tag":90,"props":192,"children":194},{"class":92,"line":193},8,[195],{"type":43,"tag":90,"props":196,"children":197},{},[198],{"type":48,"value":199},"builder.Services.AddIdentityCore\u003CApplicationUser>()\n",{"type":43,"tag":90,"props":201,"children":203},{"class":92,"line":202},9,[204],{"type":43,"tag":90,"props":205,"children":206},{},[207],{"type":48,"value":208},"    .AddRoles\u003CIdentityRole>()\n",{"type":43,"tag":90,"props":210,"children":212},{"class":92,"line":211},10,[213],{"type":43,"tag":90,"props":214,"children":215},{},[216],{"type":48,"value":217},"    .AddEntityFrameworkStores\u003CApplicationDbContext>()\n",{"type":43,"tag":90,"props":219,"children":221},{"class":92,"line":220},11,[222],{"type":43,"tag":90,"props":223,"children":224},{},[225],{"type":48,"value":226},"    .AddSignInManager()\n",{"type":43,"tag":90,"props":228,"children":230},{"class":92,"line":229},12,[231],{"type":43,"tag":90,"props":232,"children":233},{},[234],{"type":48,"value":235},"    .AddDefaultTokenProviders();\n",{"type":43,"tag":51,"props":237,"children":239},{"id":238},"step-3-wire-apprazor-for-auth-and-render-mode",[240],{"type":48,"value":241},"Step 3 — Wire App.razor for auth and render mode",{"type":43,"tag":58,"props":243,"children":244},{},[245,247,253,255,261],{"type":48,"value":246},"The ",{"type":43,"tag":64,"props":248,"children":250},{"className":249},[],[251],{"type":48,"value":252},"App.razor",{"type":48,"value":254}," component must use ",{"type":43,"tag":64,"props":256,"children":258},{"className":257},[],[259],{"type":48,"value":260},"AuthorizeRouteView",{"type":48,"value":262}," and conditionally apply the render mode so that pages excluded from interactive routing render statically.",{"type":43,"tag":79,"props":264,"children":268},{"className":265,"code":266,"language":267,"meta":84,"style":84},"language-razor shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","\u003C!DOCTYPE html>\n\u003Chtml>\n\u003Chead>\n    \u003CHeadOutlet @rendermode=\"RenderModeForPage\" \u002F>\n\u003C\u002Fhead>\n\u003Cbody>\n    \u003CRoutes @rendermode=\"RenderModeForPage\" \u002F>\n    \u003Cscript src=\"_framework\u002Fblazor.web.js\">\u003C\u002Fscript>\n\u003C\u002Fbody>\n\u003C\u002Fhtml>\n\n@code {\n    [CascadingParameter]\n    public HttpContext HttpContext { get; set; } = default!;\n\n    private IComponentRenderMode? RenderModeForPage =>\n        HttpContext.AcceptsInteractiveRouting()\n            ? InteractiveServer   \u002F\u002F replace with the app's render mode\n            : null;\n}\n","razor",[269],{"type":43,"tag":64,"props":270,"children":271},{"__ignoreMap":84},[272,280,288,296,304,312,320,328,336,344,352,359,367,376,385,393,402,411,420,429],{"type":43,"tag":90,"props":273,"children":274},{"class":92,"line":93},[275],{"type":43,"tag":90,"props":276,"children":277},{},[278],{"type":48,"value":279},"\u003C!DOCTYPE html>\n",{"type":43,"tag":90,"props":281,"children":282},{"class":92,"line":102},[283],{"type":43,"tag":90,"props":284,"children":285},{},[286],{"type":48,"value":287},"\u003Chtml>\n",{"type":43,"tag":90,"props":289,"children":290},{"class":92,"line":111},[291],{"type":43,"tag":90,"props":292,"children":293},{},[294],{"type":48,"value":295},"\u003Chead>\n",{"type":43,"tag":90,"props":297,"children":298},{"class":92,"line":156},[299],{"type":43,"tag":90,"props":300,"children":301},{},[302],{"type":48,"value":303},"    \u003CHeadOutlet @rendermode=\"RenderModeForPage\" \u002F>\n",{"type":43,"tag":90,"props":305,"children":306},{"class":92,"line":165},[307],{"type":43,"tag":90,"props":308,"children":309},{},[310],{"type":48,"value":311},"\u003C\u002Fhead>\n",{"type":43,"tag":90,"props":313,"children":314},{"class":92,"line":174},[315],{"type":43,"tag":90,"props":316,"children":317},{},[318],{"type":48,"value":319},"\u003Cbody>\n",{"type":43,"tag":90,"props":321,"children":322},{"class":92,"line":183},[323],{"type":43,"tag":90,"props":324,"children":325},{},[326],{"type":48,"value":327},"    \u003CRoutes @rendermode=\"RenderModeForPage\" \u002F>\n",{"type":43,"tag":90,"props":329,"children":330},{"class":92,"line":193},[331],{"type":43,"tag":90,"props":332,"children":333},{},[334],{"type":48,"value":335},"    \u003Cscript src=\"_framework\u002Fblazor.web.js\">\u003C\u002Fscript>\n",{"type":43,"tag":90,"props":337,"children":338},{"class":92,"line":202},[339],{"type":43,"tag":90,"props":340,"children":341},{},[342],{"type":48,"value":343},"\u003C\u002Fbody>\n",{"type":43,"tag":90,"props":345,"children":346},{"class":92,"line":211},[347],{"type":43,"tag":90,"props":348,"children":349},{},[350],{"type":48,"value":351},"\u003C\u002Fhtml>\n",{"type":43,"tag":90,"props":353,"children":354},{"class":92,"line":220},[355],{"type":43,"tag":90,"props":356,"children":357},{"emptyLinePlaceholder":187},[358],{"type":48,"value":190},{"type":43,"tag":90,"props":360,"children":361},{"class":92,"line":229},[362],{"type":43,"tag":90,"props":363,"children":364},{},[365],{"type":48,"value":366},"@code {\n",{"type":43,"tag":90,"props":368,"children":370},{"class":92,"line":369},13,[371],{"type":43,"tag":90,"props":372,"children":373},{},[374],{"type":48,"value":375},"    [CascadingParameter]\n",{"type":43,"tag":90,"props":377,"children":379},{"class":92,"line":378},14,[380],{"type":43,"tag":90,"props":381,"children":382},{},[383],{"type":48,"value":384},"    public HttpContext HttpContext { get; set; } = default!;\n",{"type":43,"tag":90,"props":386,"children":388},{"class":92,"line":387},15,[389],{"type":43,"tag":90,"props":390,"children":391},{"emptyLinePlaceholder":187},[392],{"type":48,"value":190},{"type":43,"tag":90,"props":394,"children":396},{"class":92,"line":395},16,[397],{"type":43,"tag":90,"props":398,"children":399},{},[400],{"type":48,"value":401},"    private IComponentRenderMode? RenderModeForPage =>\n",{"type":43,"tag":90,"props":403,"children":405},{"class":92,"line":404},17,[406],{"type":43,"tag":90,"props":407,"children":408},{},[409],{"type":48,"value":410},"        HttpContext.AcceptsInteractiveRouting()\n",{"type":43,"tag":90,"props":412,"children":414},{"class":92,"line":413},18,[415],{"type":43,"tag":90,"props":416,"children":417},{},[418],{"type":48,"value":419},"            ? InteractiveServer   \u002F\u002F replace with the app's render mode\n",{"type":43,"tag":90,"props":421,"children":423},{"class":92,"line":422},19,[424],{"type":43,"tag":90,"props":425,"children":426},{},[427],{"type":48,"value":428},"            : null;\n",{"type":43,"tag":90,"props":430,"children":432},{"class":92,"line":431},20,[433],{"type":43,"tag":90,"props":434,"children":435},{},[436],{"type":48,"value":437},"}\n",{"type":43,"tag":58,"props":439,"children":440},{},[441,443,449,451,456],{"type":48,"value":442},"In ",{"type":43,"tag":64,"props":444,"children":446},{"className":445},[],[447],{"type":48,"value":448},"Routes.razor",{"type":48,"value":450}," (or wherever the router lives), use ",{"type":43,"tag":64,"props":452,"children":454},{"className":453},[],[455],{"type":48,"value":260},{"type":48,"value":457},":",{"type":43,"tag":79,"props":459,"children":461},{"className":265,"code":460,"language":267,"meta":84,"style":84},"\u003CRouter AppAssembly=\"typeof(Program).Assembly\">\n    \u003CFound Context=\"routeData\">\n        \u003CAuthorizeRouteView RouteData=\"routeData\"\n                            DefaultLayout=\"typeof(Layout.MainLayout)\">\n            \u003CNotAuthorized>\n                @if (context.User.Identity?.IsAuthenticated != true)\n                {\n                    \u003CRedirectToLogin \u002F>\n                }\n                else\n                {\n                    \u003Cp>You are not authorized to access this resource.\u003C\u002Fp>\n                }\n            \u003C\u002FNotAuthorized>\n        \u003C\u002FAuthorizeRouteView>\n        \u003CFocusOnNavigate RouteData=\"routeData\" Selector=\"h1\" \u002F>\n    \u003C\u002FFound>\n\u003C\u002FRouter>\n",[462],{"type":43,"tag":64,"props":463,"children":464},{"__ignoreMap":84},[465,473,481,489,497,505,513,521,529,537,545,552,560,567,575,583,591,599],{"type":43,"tag":90,"props":466,"children":467},{"class":92,"line":93},[468],{"type":43,"tag":90,"props":469,"children":470},{},[471],{"type":48,"value":472},"\u003CRouter AppAssembly=\"typeof(Program).Assembly\">\n",{"type":43,"tag":90,"props":474,"children":475},{"class":92,"line":102},[476],{"type":43,"tag":90,"props":477,"children":478},{},[479],{"type":48,"value":480},"    \u003CFound Context=\"routeData\">\n",{"type":43,"tag":90,"props":482,"children":483},{"class":92,"line":111},[484],{"type":43,"tag":90,"props":485,"children":486},{},[487],{"type":48,"value":488},"        \u003CAuthorizeRouteView RouteData=\"routeData\"\n",{"type":43,"tag":90,"props":490,"children":491},{"class":92,"line":156},[492],{"type":43,"tag":90,"props":493,"children":494},{},[495],{"type":48,"value":496},"                            DefaultLayout=\"typeof(Layout.MainLayout)\">\n",{"type":43,"tag":90,"props":498,"children":499},{"class":92,"line":165},[500],{"type":43,"tag":90,"props":501,"children":502},{},[503],{"type":48,"value":504},"            \u003CNotAuthorized>\n",{"type":43,"tag":90,"props":506,"children":507},{"class":92,"line":174},[508],{"type":43,"tag":90,"props":509,"children":510},{},[511],{"type":48,"value":512},"                @if (context.User.Identity?.IsAuthenticated != true)\n",{"type":43,"tag":90,"props":514,"children":515},{"class":92,"line":183},[516],{"type":43,"tag":90,"props":517,"children":518},{},[519],{"type":48,"value":520},"                {\n",{"type":43,"tag":90,"props":522,"children":523},{"class":92,"line":193},[524],{"type":43,"tag":90,"props":525,"children":526},{},[527],{"type":48,"value":528},"                    \u003CRedirectToLogin \u002F>\n",{"type":43,"tag":90,"props":530,"children":531},{"class":92,"line":202},[532],{"type":43,"tag":90,"props":533,"children":534},{},[535],{"type":48,"value":536},"                }\n",{"type":43,"tag":90,"props":538,"children":539},{"class":92,"line":211},[540],{"type":43,"tag":90,"props":541,"children":542},{},[543],{"type":48,"value":544},"                else\n",{"type":43,"tag":90,"props":546,"children":547},{"class":92,"line":220},[548],{"type":43,"tag":90,"props":549,"children":550},{},[551],{"type":48,"value":520},{"type":43,"tag":90,"props":553,"children":554},{"class":92,"line":229},[555],{"type":43,"tag":90,"props":556,"children":557},{},[558],{"type":48,"value":559},"                    \u003Cp>You are not authorized to access this resource.\u003C\u002Fp>\n",{"type":43,"tag":90,"props":561,"children":562},{"class":92,"line":369},[563],{"type":43,"tag":90,"props":564,"children":565},{},[566],{"type":48,"value":536},{"type":43,"tag":90,"props":568,"children":569},{"class":92,"line":378},[570],{"type":43,"tag":90,"props":571,"children":572},{},[573],{"type":48,"value":574},"            \u003C\u002FNotAuthorized>\n",{"type":43,"tag":90,"props":576,"children":577},{"class":92,"line":387},[578],{"type":43,"tag":90,"props":579,"children":580},{},[581],{"type":48,"value":582},"        \u003C\u002FAuthorizeRouteView>\n",{"type":43,"tag":90,"props":584,"children":585},{"class":92,"line":395},[586],{"type":43,"tag":90,"props":587,"children":588},{},[589],{"type":48,"value":590},"        \u003CFocusOnNavigate RouteData=\"routeData\" Selector=\"h1\" \u002F>\n",{"type":43,"tag":90,"props":592,"children":593},{"class":92,"line":404},[594],{"type":43,"tag":90,"props":595,"children":596},{},[597],{"type":48,"value":598},"    \u003C\u002FFound>\n",{"type":43,"tag":90,"props":600,"children":601},{"class":92,"line":413},[602],{"type":43,"tag":90,"props":603,"children":604},{},[605],{"type":48,"value":606},"\u003C\u002FRouter>\n",{"type":43,"tag":51,"props":608,"children":610},{"id":609},"step-4-protect-pages-and-components",[611],{"type":48,"value":612},"Step 4 — Protect pages and components",{"type":43,"tag":614,"props":615,"children":617},"h3",{"id":616},"authorize-attribute-on-pages",[618,623],{"type":43,"tag":90,"props":619,"children":620},{},[621],{"type":48,"value":622},"Authorize",{"type":48,"value":624}," attribute on pages",{"type":43,"tag":79,"props":626,"children":628},{"className":265,"code":627,"language":267,"meta":84,"style":84},"@page \"\u002Fadmin\"\n@attribute [Authorize]\n",[629],{"type":43,"tag":64,"props":630,"children":631},{"__ignoreMap":84},[632,640],{"type":43,"tag":90,"props":633,"children":634},{"class":92,"line":93},[635],{"type":43,"tag":90,"props":636,"children":637},{},[638],{"type":48,"value":639},"@page \"\u002Fadmin\"\n",{"type":43,"tag":90,"props":641,"children":642},{"class":92,"line":102},[643],{"type":43,"tag":90,"props":644,"children":645},{},[646],{"type":48,"value":647},"@attribute [Authorize]\n",{"type":43,"tag":58,"props":649,"children":650},{},[651],{"type":48,"value":652},"With roles or policies:",{"type":43,"tag":79,"props":654,"children":656},{"className":265,"code":655,"language":267,"meta":84,"style":84},"@attribute [Authorize(Roles = \"Admin\")]\n@attribute [Authorize(Policy = \"RequireManager\")]\n",[657],{"type":43,"tag":64,"props":658,"children":659},{"__ignoreMap":84},[660,668],{"type":43,"tag":90,"props":661,"children":662},{"class":92,"line":93},[663],{"type":43,"tag":90,"props":664,"children":665},{},[666],{"type":48,"value":667},"@attribute [Authorize(Roles = \"Admin\")]\n",{"type":43,"tag":90,"props":669,"children":670},{"class":92,"line":102},[671],{"type":43,"tag":90,"props":672,"children":673},{},[674],{"type":48,"value":675},"@attribute [Authorize(Policy = \"RequireManager\")]\n",{"type":43,"tag":614,"props":677,"children":679},{"id":678},"authorizeview-for-conditional-ui",[680],{"type":48,"value":681},"AuthorizeView for conditional UI",{"type":43,"tag":79,"props":683,"children":685},{"className":265,"code":684,"language":267,"meta":84,"style":84},"\u003CAuthorizeView>\n    \u003CAuthorized>Welcome, @context.User.Identity?.Name!\u003C\u002FAuthorized>\n    \u003CNotAuthorized>\u003Ca href=\"Account\u002FLogin\">Log in\u003C\u002Fa>\u003C\u002FNotAuthorized>\n\u003C\u002FAuthorizeView>\n",[686],{"type":43,"tag":64,"props":687,"children":688},{"__ignoreMap":84},[689,697,705,713],{"type":43,"tag":90,"props":690,"children":691},{"class":92,"line":93},[692],{"type":43,"tag":90,"props":693,"children":694},{},[695],{"type":48,"value":696},"\u003CAuthorizeView>\n",{"type":43,"tag":90,"props":698,"children":699},{"class":92,"line":102},[700],{"type":43,"tag":90,"props":701,"children":702},{},[703],{"type":48,"value":704},"    \u003CAuthorized>Welcome, @context.User.Identity?.Name!\u003C\u002FAuthorized>\n",{"type":43,"tag":90,"props":706,"children":707},{"class":92,"line":111},[708],{"type":43,"tag":90,"props":709,"children":710},{},[711],{"type":48,"value":712},"    \u003CNotAuthorized>\u003Ca href=\"Account\u002FLogin\">Log in\u003C\u002Fa>\u003C\u002FNotAuthorized>\n",{"type":43,"tag":90,"props":714,"children":715},{"class":92,"line":156},[716],{"type":43,"tag":90,"props":717,"children":718},{},[719],{"type":48,"value":720},"\u003C\u002FAuthorizeView>\n",{"type":43,"tag":58,"props":722,"children":723},{},[724],{"type":48,"value":725},"Role\u002Fpolicy variants:",{"type":43,"tag":79,"props":727,"children":729},{"className":265,"code":728,"language":267,"meta":84,"style":84},"\u003CAuthorizeView Roles=\"Admin,Manager\">\n    \u003CAuthorized>Admin content here\u003C\u002FAuthorized>\n\u003C\u002FAuthorizeView>\n",[730],{"type":43,"tag":64,"props":731,"children":732},{"__ignoreMap":84},[733,741,749],{"type":43,"tag":90,"props":734,"children":735},{"class":92,"line":93},[736],{"type":43,"tag":90,"props":737,"children":738},{},[739],{"type":48,"value":740},"\u003CAuthorizeView Roles=\"Admin,Manager\">\n",{"type":43,"tag":90,"props":742,"children":743},{"class":92,"line":102},[744],{"type":43,"tag":90,"props":745,"children":746},{},[747],{"type":48,"value":748},"    \u003CAuthorized>Admin content here\u003C\u002FAuthorized>\n",{"type":43,"tag":90,"props":750,"children":751},{"class":92,"line":111},[752],{"type":43,"tag":90,"props":753,"children":754},{},[755],{"type":48,"value":720},{"type":43,"tag":614,"props":757,"children":759},{"id":758},"access-auth-state-in-code",[760],{"type":48,"value":761},"Access auth state in code",{"type":43,"tag":79,"props":763,"children":765},{"className":81,"code":764,"language":83,"meta":84,"style":84},"[CascadingParameter]\nprivate Task\u003CAuthenticationState>? AuthState { get; set; }\n\nprotected override async Task OnInitializedAsync()\n{\n    if (AuthState is not null)\n    {\n        var state = await AuthState;\n        var isAdmin = state.User.IsInRole(\"Admin\");\n    }\n}\n",[766],{"type":43,"tag":64,"props":767,"children":768},{"__ignoreMap":84},[769,777,785,792,800,807,815,823,831,839,847],{"type":43,"tag":90,"props":770,"children":771},{"class":92,"line":93},[772],{"type":43,"tag":90,"props":773,"children":774},{},[775],{"type":48,"value":776},"[CascadingParameter]\n",{"type":43,"tag":90,"props":778,"children":779},{"class":92,"line":102},[780],{"type":43,"tag":90,"props":781,"children":782},{},[783],{"type":48,"value":784},"private Task\u003CAuthenticationState>? AuthState { get; set; }\n",{"type":43,"tag":90,"props":786,"children":787},{"class":92,"line":111},[788],{"type":43,"tag":90,"props":789,"children":790},{"emptyLinePlaceholder":187},[791],{"type":48,"value":190},{"type":43,"tag":90,"props":793,"children":794},{"class":92,"line":156},[795],{"type":43,"tag":90,"props":796,"children":797},{},[798],{"type":48,"value":799},"protected override async Task OnInitializedAsync()\n",{"type":43,"tag":90,"props":801,"children":802},{"class":92,"line":165},[803],{"type":43,"tag":90,"props":804,"children":805},{},[806],{"type":48,"value":145},{"type":43,"tag":90,"props":808,"children":809},{"class":92,"line":174},[810],{"type":43,"tag":90,"props":811,"children":812},{},[813],{"type":48,"value":814},"    if (AuthState is not null)\n",{"type":43,"tag":90,"props":816,"children":817},{"class":92,"line":183},[818],{"type":43,"tag":90,"props":819,"children":820},{},[821],{"type":48,"value":822},"    {\n",{"type":43,"tag":90,"props":824,"children":825},{"class":92,"line":193},[826],{"type":43,"tag":90,"props":827,"children":828},{},[829],{"type":48,"value":830},"        var state = await AuthState;\n",{"type":43,"tag":90,"props":832,"children":833},{"class":92,"line":202},[834],{"type":43,"tag":90,"props":835,"children":836},{},[837],{"type":48,"value":838},"        var isAdmin = state.User.IsInRole(\"Admin\");\n",{"type":43,"tag":90,"props":840,"children":841},{"class":92,"line":211},[842],{"type":43,"tag":90,"props":843,"children":844},{},[845],{"type":48,"value":846},"    }\n",{"type":43,"tag":90,"props":848,"children":849},{"class":92,"line":220},[850],{"type":43,"tag":90,"props":851,"children":852},{},[853],{"type":48,"value":437},{"type":43,"tag":51,"props":855,"children":857},{"id":856},"step-5-identity-pages-must-stay-static-ssr",[858],{"type":48,"value":859},"Step 5 — Identity pages must stay static SSR",{"type":43,"tag":58,"props":861,"children":862},{},[863,869,871,877,879,885,887,893],{"type":43,"tag":64,"props":864,"children":866},{"className":865},[],[867],{"type":48,"value":868},"SignInManager",{"type":48,"value":870}," and ",{"type":43,"tag":64,"props":872,"children":874},{"className":873},[],[875],{"type":48,"value":876},"UserManager",{"type":48,"value":878}," use ",{"type":43,"tag":64,"props":880,"children":882},{"className":881},[],[883],{"type":48,"value":884},"HttpContext",{"type":48,"value":886}," internally and ",{"type":43,"tag":888,"props":889,"children":890},"strong",{},[891],{"type":48,"value":892},"throw in interactive components",{"type":48,"value":894},". Identity pages (login, register, manage) must render as static SSR.",{"type":43,"tag":58,"props":896,"children":897},{},[898,900,905],{"type":48,"value":899},"In a ",{"type":43,"tag":888,"props":901,"children":902},{},[903],{"type":48,"value":904},"globally interactive",{"type":48,"value":906}," app, mark every Identity page:",{"type":43,"tag":79,"props":908,"children":910},{"className":265,"code":909,"language":267,"meta":84,"style":84},"@page \"\u002FAccount\u002FLogin\"\n@attribute [ExcludeFromInteractiveRouting]\n",[911],{"type":43,"tag":64,"props":912,"children":913},{"__ignoreMap":84},[914,922],{"type":43,"tag":90,"props":915,"children":916},{"class":92,"line":93},[917],{"type":43,"tag":90,"props":918,"children":919},{},[920],{"type":48,"value":921},"@page \"\u002FAccount\u002FLogin\"\n",{"type":43,"tag":90,"props":923,"children":924},{"class":92,"line":102},[925],{"type":43,"tag":90,"props":926,"children":927},{},[928],{"type":48,"value":929},"@attribute [ExcludeFromInteractiveRouting]\n",{"type":43,"tag":58,"props":931,"children":932},{},[933,935,940],{"type":48,"value":934},"This forces a full-page navigation (exits the interactive circuit) so the page renders through the static SSR pipeline with a real ",{"type":43,"tag":64,"props":936,"children":938},{"className":937},[],[939],{"type":48,"value":884},{"type":48,"value":941},".",{"type":43,"tag":58,"props":943,"children":944},{},[945,950,952,958,960,966],{"type":43,"tag":64,"props":946,"children":948},{"className":947},[],[949],{"type":48,"value":252},{"type":48,"value":951}," must use ",{"type":43,"tag":64,"props":953,"children":955},{"className":954},[],[956],{"type":48,"value":957},"AcceptsInteractiveRouting()",{"type":48,"value":959}," (Step 3) to return ",{"type":43,"tag":64,"props":961,"children":963},{"className":962},[],[964],{"type":48,"value":965},"null",{"type":48,"value":967}," for these pages — otherwise the framework still tries to render them interactively.",{"type":43,"tag":58,"props":969,"children":970},{},[971,972,977,979,985,987,993],{"type":48,"value":899},{"type":43,"tag":888,"props":973,"children":974},{},[975],{"type":48,"value":976},"per-page",{"type":48,"value":978}," app, Identity pages are static by default (no ",{"type":43,"tag":64,"props":980,"children":982},{"className":981},[],[983],{"type":48,"value":984},"@rendermode",{"type":48,"value":986}," directive), so ",{"type":43,"tag":64,"props":988,"children":990},{"className":989},[],[991],{"type":48,"value":992},"[ExcludeFromInteractiveRouting]",{"type":48,"value":994}," is not needed.",{"type":43,"tag":51,"props":996,"children":998},{"id":997},"step-6-auth-state-in-webassembly-auto-mode",[999],{"type":48,"value":1000},"Step 6 — Auth state in WebAssembly \u002F Auto mode",{"type":43,"tag":58,"props":1002,"children":1003},{},[1004,1006,1011],{"type":48,"value":1005},"WebAssembly components run in the browser and have no ",{"type":43,"tag":64,"props":1007,"children":1009},{"className":1008},[],[1010],{"type":48,"value":884},{"type":48,"value":1012},". Auth state must be serialized from the server during prerendering and deserialized on the client.",{"type":43,"tag":58,"props":1014,"children":1015},{},[1016],{"type":43,"tag":888,"props":1017,"children":1018},{},[1019,1021,1027],{"type":48,"value":1020},"Server ",{"type":43,"tag":64,"props":1022,"children":1024},{"className":1023},[],[1025],{"type":48,"value":1026},"Program.cs",{"type":48,"value":457},{"type":43,"tag":79,"props":1029,"children":1031},{"className":81,"code":1030,"language":83,"meta":84,"style":84},"builder.Services.AddAuthenticationStateSerialization();\n",[1032],{"type":43,"tag":64,"props":1033,"children":1034},{"__ignoreMap":84},[1035],{"type":43,"tag":90,"props":1036,"children":1037},{"class":92,"line":93},[1038],{"type":43,"tag":90,"props":1039,"children":1040},{},[1041],{"type":48,"value":1030},{"type":43,"tag":58,"props":1043,"children":1044},{},[1045],{"type":43,"tag":888,"props":1046,"children":1047},{},[1048,1050,1056],{"type":48,"value":1049},"Client ",{"type":43,"tag":64,"props":1051,"children":1053},{"className":1052},[],[1054],{"type":48,"value":1055},".Client\u002FProgram.cs",{"type":48,"value":457},{"type":43,"tag":79,"props":1058,"children":1060},{"className":81,"code":1059,"language":83,"meta":84,"style":84},"builder.Services.AddAuthenticationStateDeserialization();\n",[1061],{"type":43,"tag":64,"props":1062,"children":1063},{"__ignoreMap":84},[1064],{"type":43,"tag":90,"props":1065,"children":1066},{"class":92,"line":93},[1067],{"type":43,"tag":90,"props":1068,"children":1069},{},[1070],{"type":48,"value":1059},{"type":43,"tag":58,"props":1072,"children":1073},{},[1074,1076,1082],{"type":48,"value":1075},"Without these calls, ",{"type":43,"tag":64,"props":1077,"children":1079},{"className":1078},[],[1080],{"type":48,"value":1081},"Task\u003CAuthenticationState>",{"type":48,"value":1083}," resolves to an anonymous user after WebAssembly takes over from prerendering.",{"type":43,"tag":58,"props":1085,"children":1086},{},[1087,1093],{"type":43,"tag":64,"props":1088,"children":1090},{"className":1089},[],[1091],{"type":48,"value":1092},"AddAuthenticationStateSerialization",{"type":48,"value":1094}," accepts options to include role and claim data:",{"type":43,"tag":79,"props":1096,"children":1098},{"className":81,"code":1097,"language":83,"meta":84,"style":84},"builder.Services.AddAuthenticationStateSerialization(options =>\n    options.SerializeAllClaims = true);\n",[1099],{"type":43,"tag":64,"props":1100,"children":1101},{"__ignoreMap":84},[1102,1110],{"type":43,"tag":90,"props":1103,"children":1104},{"class":92,"line":93},[1105],{"type":43,"tag":90,"props":1106,"children":1107},{},[1108],{"type":48,"value":1109},"builder.Services.AddAuthenticationStateSerialization(options =>\n",{"type":43,"tag":90,"props":1111,"children":1112},{"class":92,"line":102},[1113],{"type":43,"tag":90,"props":1114,"children":1115},{},[1116],{"type":48,"value":1117},"    options.SerializeAllClaims = true);\n",{"type":43,"tag":51,"props":1119,"children":1121},{"id":1120},"render-mode-auth-matrix",[1122],{"type":48,"value":1123},"Render Mode × Auth Matrix",{"type":43,"tag":1125,"props":1126,"children":1127},"table",{},[1128,1161],{"type":43,"tag":1129,"props":1130,"children":1131},"thead",{},[1132],{"type":43,"tag":1133,"props":1134,"children":1135},"tr",{},[1136,1142,1147,1151,1156],{"type":43,"tag":1137,"props":1138,"children":1139},"th",{},[1140],{"type":48,"value":1141},"Render mode",{"type":43,"tag":1137,"props":1143,"children":1144},{},[1145],{"type":48,"value":1146},"HttpContext.User",{"type":43,"tag":1137,"props":1148,"children":1149},{},[1150],{"type":48,"value":868},{"type":43,"tag":1137,"props":1152,"children":1153},{},[1154],{"type":48,"value":1155},"Auth state source",{"type":43,"tag":1137,"props":1157,"children":1158},{},[1159],{"type":48,"value":1160},"Key requirement",{"type":43,"tag":1162,"props":1163,"children":1164},"tbody",{},[1165,1202,1255,1292],{"type":43,"tag":1133,"props":1166,"children":1167},{},[1168,1174,1179,1184,1189],{"type":43,"tag":1169,"props":1170,"children":1171},"td",{},[1172],{"type":48,"value":1173},"Static SSR",{"type":43,"tag":1169,"props":1175,"children":1176},{},[1177],{"type":48,"value":1178},"Available",{"type":43,"tag":1169,"props":1180,"children":1181},{},[1182],{"type":48,"value":1183},"Works",{"type":43,"tag":1169,"props":1185,"children":1186},{},[1187],{"type":48,"value":1188},"Server pipeline",{"type":43,"tag":1169,"props":1190,"children":1191},{},[1192,1194,1200],{"type":48,"value":1193},"Use middleware for redirects, ",{"type":43,"tag":64,"props":1195,"children":1197},{"className":1196},[],[1198],{"type":48,"value":1199},"\u003CNotAuthorized>",{"type":48,"value":1201}," does NOT render",{"type":43,"tag":1133,"props":1203,"children":1204},{},[1205,1210,1215,1220,1229],{"type":43,"tag":1169,"props":1206,"children":1207},{},[1208],{"type":48,"value":1209},"Server (interactive)",{"type":43,"tag":1169,"props":1211,"children":1212},{},[1213],{"type":48,"value":1214},"NOT available",{"type":43,"tag":1169,"props":1216,"children":1217},{},[1218],{"type":48,"value":1219},"Throws",{"type":43,"tag":1169,"props":1221,"children":1222},{},[1223],{"type":43,"tag":64,"props":1224,"children":1226},{"className":1225},[],[1227],{"type":48,"value":1228},"CascadingAuthenticationState",{"type":43,"tag":1169,"props":1230,"children":1231},{},[1232,1234,1240,1242,1248,1250],{"type":48,"value":1233},"Use ",{"type":43,"tag":64,"props":1235,"children":1237},{"className":1236},[],[1238],{"type":48,"value":1239},"[Authorize]",{"type":48,"value":1241}," + ",{"type":43,"tag":64,"props":1243,"children":1245},{"className":1244},[],[1246],{"type":48,"value":1247},"AuthorizeView",{"type":48,"value":1249},", not ",{"type":43,"tag":64,"props":1251,"children":1253},{"className":1252},[],[1254],{"type":48,"value":884},{"type":43,"tag":1133,"props":1256,"children":1257},{},[1258,1263,1267,1271,1276],{"type":43,"tag":1169,"props":1259,"children":1260},{},[1261],{"type":48,"value":1262},"WebAssembly",{"type":43,"tag":1169,"props":1264,"children":1265},{},[1266],{"type":48,"value":1214},{"type":43,"tag":1169,"props":1268,"children":1269},{},[1270],{"type":48,"value":1219},{"type":43,"tag":1169,"props":1272,"children":1273},{},[1274],{"type":48,"value":1275},"Serialized from server",{"type":43,"tag":1169,"props":1277,"children":1278},{},[1279,1284,1286],{"type":43,"tag":64,"props":1280,"children":1282},{"className":1281},[],[1283],{"type":48,"value":1092},{"type":48,"value":1285}," \u002F ",{"type":43,"tag":64,"props":1287,"children":1289},{"className":1288},[],[1290],{"type":48,"value":1291},"Deserialization",{"type":43,"tag":1133,"props":1293,"children":1294},{},[1295,1300,1305,1309,1313],{"type":43,"tag":1169,"props":1296,"children":1297},{},[1298],{"type":48,"value":1299},"Auto",{"type":43,"tag":1169,"props":1301,"children":1302},{},[1303],{"type":48,"value":1304},"NOT available after WASM",{"type":43,"tag":1169,"props":1306,"children":1307},{},[1308],{"type":48,"value":1219},{"type":43,"tag":1169,"props":1310,"children":1311},{},[1312],{"type":48,"value":1275},{"type":43,"tag":1169,"props":1314,"children":1315},{},[1316,1318,1323],{"type":48,"value":1317},"Same as WebAssembly; register in ",{"type":43,"tag":888,"props":1319,"children":1320},{},[1321],{"type":48,"value":1322},"both",{"type":48,"value":1324}," Program.cs files",{"type":43,"tag":51,"props":1326,"children":1328},{"id":1327},"common-mistakes",[1329],{"type":48,"value":1330},"Common Mistakes",{"type":43,"tag":1125,"props":1332,"children":1333},{},[1334,1355],{"type":43,"tag":1129,"props":1335,"children":1336},{},[1337],{"type":43,"tag":1133,"props":1338,"children":1339},{},[1340,1345,1350],{"type":43,"tag":1137,"props":1341,"children":1342},{},[1343],{"type":48,"value":1344},"Mistake",{"type":43,"tag":1137,"props":1346,"children":1347},{},[1348],{"type":48,"value":1349},"Symptom",{"type":43,"tag":1137,"props":1351,"children":1352},{},[1353],{"type":48,"value":1354},"Fix",{"type":43,"tag":1162,"props":1356,"children":1357},{},[1358,1388,1419,1449,1488,1519],{"type":43,"tag":1133,"props":1359,"children":1360},{},[1361,1373,1378],{"type":43,"tag":1169,"props":1362,"children":1363},{},[1364,1366,1371],{"type":48,"value":1365},"Using ",{"type":43,"tag":64,"props":1367,"children":1369},{"className":1368},[],[1370],{"type":48,"value":1146},{"type":48,"value":1372}," in interactive component",{"type":43,"tag":1169,"props":1374,"children":1375},{},[1376],{"type":48,"value":1377},"Null or stale claims",{"type":43,"tag":1169,"props":1379,"children":1380},{},[1381,1382],{"type":48,"value":1233},{"type":43,"tag":64,"props":1383,"children":1385},{"className":1384},[],[1386],{"type":48,"value":1387},"[CascadingParameter] Task\u003CAuthenticationState>",{"type":43,"tag":1133,"props":1389,"children":1390},{},[1391,1400,1409],{"type":43,"tag":1169,"props":1392,"children":1393},{},[1394,1399],{"type":43,"tag":64,"props":1395,"children":1397},{"className":1396},[],[1398],{"type":48,"value":868},{"type":48,"value":1372},{"type":43,"tag":1169,"props":1401,"children":1402},{},[1403],{"type":43,"tag":64,"props":1404,"children":1406},{"className":1405},[],[1407],{"type":48,"value":1408},"InvalidOperationException",{"type":43,"tag":1169,"props":1410,"children":1411},{},[1412,1414],{"type":48,"value":1413},"Move to static SSR page with ",{"type":43,"tag":64,"props":1415,"children":1417},{"className":1416},[],[1418],{"type":48,"value":992},{"type":43,"tag":1133,"props":1420,"children":1421},{},[1422,1432,1437],{"type":43,"tag":1169,"props":1423,"children":1424},{},[1425,1427],{"type":48,"value":1426},"Missing ",{"type":43,"tag":64,"props":1428,"children":1430},{"className":1429},[],[1431],{"type":48,"value":1092},{"type":43,"tag":1169,"props":1433,"children":1434},{},[1435],{"type":48,"value":1436},"Anonymous user after WASM loads",{"type":43,"tag":1169,"props":1438,"children":1439},{},[1440,1442,1447],{"type":48,"value":1441},"Add to server Program.cs; add ",{"type":43,"tag":64,"props":1443,"children":1445},{"className":1444},[],[1446],{"type":48,"value":1291},{"type":48,"value":1448}," to client Program.cs",{"type":43,"tag":1133,"props":1450,"children":1451},{},[1452,1462,1467],{"type":43,"tag":1169,"props":1453,"children":1454},{},[1455,1460],{"type":43,"tag":64,"props":1456,"children":1458},{"className":1457},[],[1459],{"type":48,"value":1199},{"type":48,"value":1461}," in static SSR layout",{"type":43,"tag":1169,"props":1463,"children":1464},{},[1465],{"type":48,"value":1466},"Content never shown",{"type":43,"tag":1169,"props":1468,"children":1469},{},[1470,1472,1478,1480,1486],{"type":48,"value":1471},"Static SSR uses middleware pipeline; redirect via ",{"type":43,"tag":64,"props":1473,"children":1475},{"className":1474},[],[1476],{"type":48,"value":1477},"LoginPath",{"type":48,"value":1479}," or ",{"type":43,"tag":64,"props":1481,"children":1483},{"className":1482},[],[1484],{"type":48,"value":1485},"RedirectToLogin",{"type":48,"value":1487}," component",{"type":43,"tag":1133,"props":1489,"children":1490},{},[1491,1502,1507],{"type":43,"tag":1169,"props":1492,"children":1493},{},[1494,1496],{"type":48,"value":1495},"Global interactivity without ",{"type":43,"tag":64,"props":1497,"children":1499},{"className":1498},[],[1500],{"type":48,"value":1501},"AcceptsInteractiveRouting",{"type":43,"tag":1169,"props":1503,"children":1504},{},[1505],{"type":48,"value":1506},"Identity pages crash",{"type":43,"tag":1169,"props":1508,"children":1509},{},[1510,1512,1517],{"type":48,"value":1511},"Add ",{"type":43,"tag":64,"props":1513,"children":1515},{"className":1514},[],[1516],{"type":48,"value":957},{"type":48,"value":1518}," check in App.razor (Step 3)",{"type":43,"tag":1133,"props":1520,"children":1521},{},[1522,1532,1542],{"type":43,"tag":1169,"props":1523,"children":1524},{},[1525,1526],{"type":48,"value":1426},{"type":43,"tag":64,"props":1527,"children":1529},{"className":1528},[],[1530],{"type":48,"value":1531},"AddCascadingAuthenticationState()",{"type":43,"tag":1169,"props":1533,"children":1534},{},[1535,1540],{"type":43,"tag":64,"props":1536,"children":1538},{"className":1537},[],[1539],{"type":48,"value":1081},{"type":48,"value":1541}," is null",{"type":43,"tag":1169,"props":1543,"children":1544},{},[1545],{"type":48,"value":1546},"Register in Program.cs (Step 2)",{"type":43,"tag":1548,"props":1549,"children":1550},"style",{},[1551],{"type":48,"value":1552},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"items":1554,"total":1660},[1555,1572,1587,1605,1619,1636,1646],{"slug":1556,"name":1556,"fn":1557,"description":1558,"org":1559,"tags":1560,"stars":25,"repoUrl":26,"updatedAt":1571},"analyzing-dotnet-performance","analyze .NET code for performance anti-patterns","Scans .NET code for ~50 performance anti-patterns across async, memory, strings, collections, LINQ, regex, serialization, and I\u002FO with tiered severity classification. Use when analyzing .NET code for optimization opportunities, reviewing hot paths, or auditing allocation-heavy patterns.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1561,1562,1565,1568],{"name":17,"slug":18,"type":15},{"name":1563,"slug":1564,"type":15},"Code Analysis","code-analysis",{"name":1566,"slug":1567,"type":15},"Debugging","debugging",{"name":1569,"slug":1570,"type":15},"Performance","performance","2026-07-12T08:23:25.400375",{"slug":1573,"name":1573,"fn":1574,"description":1575,"org":1576,"tags":1577,"stars":25,"repoUrl":26,"updatedAt":1586},"android-tombstone-symbolication","symbolicate .NET runtime frames in Android tombstones","Symbolicate the .NET runtime frames in an Android tombstone file. Extracts BuildIds and PC offsets from the native backtrace, downloads debug symbols from the Microsoft symbol server, and runs llvm-symbolizer to produce function names with source file and line numbers. USE FOR triaging a .NET MAUI or Mono Android app crash from a tombstone, resolving native backtrace frames in libmonosgen-2.0.so or libcoreclr.so to .NET runtime source code, or investigating SIGABRT, SIGSEGV, or other native signals originating from the .NET runtime on Android. DO NOT USE FOR pure Java\u002FKotlin crashes, managed .NET exceptions that are already captured in logcat, or iOS crash logs. INVOKES Symbolicate-Tombstone.ps1 script, llvm-symbolizer, Microsoft symbol server.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1578,1579,1582,1583],{"name":17,"slug":18,"type":15},{"name":1580,"slug":1581,"type":15},"Android","android",{"name":1566,"slug":1567,"type":15},{"name":1584,"slug":1585,"type":15},"Microsoft","microsoft","2026-07-12T08:23:21.595572",{"slug":1588,"name":1588,"fn":1589,"description":1590,"org":1591,"tags":1592,"stars":25,"repoUrl":26,"updatedAt":1604},"apple-crash-symbolication","symbolicate .NET runtime frames in crash logs","Symbolicate .NET runtime frames in Apple platform .ips crash logs (iOS, tvOS, Mac Catalyst, macOS). Extracts UUIDs and addresses from the native backtrace, locates dSYM debug symbols, and runs atos to produce function names with source file and line numbers. Automatically downloads .dwarf symbols from the Microsoft symbol server using Mach-O UUIDs. USE FOR triaging a .NET MAUI or Mono app crash from an .ips file on any Apple platform, resolving native backtrace frames in libcoreclr or libmonosgen-2.0 to .NET runtime source code, retrieving .ips crash logs from a connected iOS device or iPhone, or investigating EXC_CRASH, EXC_BAD_ACCESS, SIGABRT, or SIGSEGV originating from the .NET runtime. DO NOT USE FOR pure Swift\u002FObjective-C crashes with no .NET components, or Android tombstone files. INVOKES Symbolicate-Crash.ps1 script, atos, dwarfdump, idevicecrashreport.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1593,1594,1595,1598,1601],{"name":17,"slug":18,"type":15},{"name":1566,"slug":1567,"type":15},{"name":1596,"slug":1597,"type":15},"iOS","ios",{"name":1599,"slug":1600,"type":15},"macOS","macos",{"name":1602,"slug":1603,"type":15},"Observability","observability","2026-07-12T08:23:20.369986",{"slug":1606,"name":1606,"fn":1607,"description":1608,"org":1609,"tags":1610,"stars":25,"repoUrl":26,"updatedAt":1618},"assertion-quality","evaluate assertion quality in test suites","Analyzes the variety and depth of assertions across test suites in any language. Use when the user asks to evaluate assertion quality, find shallow tests, identify assertion-free tests (no assertions or only trivial ones like Assert.IsNotNull \u002F toBeTruthy()), flag self-referential or tautological assertions, measure assertion diversity, or audit whether tests verify different facets of behavior. Polyglot: .NET, Python, TS\u002FJS, Java, Go, Ruby, Rust, Swift, Kotlin, PowerShell, C++. DO NOT USE FOR: writing new tests (use code-testing-agent \u002F writing-mstest-tests), mutation reasoning about whether tests would catch a bug (use test-gap-analysis), or a general severity-ranked anti-pattern audit (use test-anti-patterns), fixing or rewriting assertions, or writing, fixing, or modernizing MSTest tests, assertions, or attributes (use writing-mstest-tests).",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1611,1612,1615],{"name":1563,"slug":1564,"type":15},{"name":1613,"slug":1614,"type":15},"QA","qa",{"name":1616,"slug":1617,"type":15},"Testing","testing","2026-07-12T08:23:51.277743",{"slug":1620,"name":1620,"fn":1621,"description":1622,"org":1623,"tags":1624,"stars":25,"repoUrl":26,"updatedAt":1635},"author-component","create and review Blazor components","Create or review Blazor components (.razor files) with correct architecture. USE FOR: writing new Blazor components that do NOT involve JavaScript interop, implementing parameters and EventCallback, RenderFragment slots, component lifecycle (OnInitializedAsync, OnParametersSet), async patterns, IAsyncDisposable, CancellationToken, CSS isolation, code-behind. DO NOT USE FOR: creating new projects (use create-blazor-project), JavaScript interop or calling browser APIs from Blazor (use use-js-interop), forms and validation (use collect-user-input), prerendering issues (use support-prerendering), HTTP data fetching patterns (use fetch-and-send-data), coordinating state between unrelated components (use coordinate-components).\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1625,1626,1627,1629,1632],{"name":17,"slug":18,"type":15},{"name":23,"slug":24,"type":15},{"name":1628,"slug":83,"type":15},"C#",{"name":1630,"slug":1631,"type":15},"UI Components","ui-components",{"name":1633,"slug":1634,"type":15},"Web Development","web-development","2026-07-15T06:03:29.216359",{"slug":1637,"name":1637,"fn":1638,"description":1639,"org":1640,"tags":1641,"stars":25,"repoUrl":26,"updatedAt":1645},"binlog-failure-analysis","analyze MSBuild binary logs","Analyze MSBuild binary logs to diagnose build failures. USE FOR: build errors that are unclear from console output, diagnosing cascading failures across multi-project builds, tracing MSBuild target execution order, and generally any MSBuild build issues. Requires an existing .binlog file. DO NOT USE FOR: generating binlogs (use binlog-generation), non-MSBuild build systems.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1642,1643,1644],{"name":1563,"slug":1564,"type":15},{"name":1566,"slug":1567,"type":15},{"name":1584,"slug":1585,"type":15},"2026-07-12T08:21:34.637923",{"slug":1647,"name":1647,"fn":1648,"description":1649,"org":1650,"tags":1651,"stars":25,"repoUrl":26,"updatedAt":1659},"binlog-generation","generate MSBuild binary logs for diagnostics","Generate MSBuild binary logs (binlogs) for build diagnostics and analysis. USE FOR: adding \u002Fbl:{} to any dotnet build, test, pack, publish, or restore command to capture a full build execution trace, prerequisite for binlog-failure-analysis and build-perf-diagnostics skills, enabling post-build investigation of errors or performance. Requires MSBuild 17.8+ \u002F .NET 8 SDK+ for {} placeholder; PowerShell needs -bl:{{}}. DO NOT USE FOR: non-MSBuild build systems (npm, Maven, CMake), analyzing an existing binlog (use binlog-failure-analysis instead).",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1652,1655,1656],{"name":1653,"slug":1654,"type":15},"Build","build",{"name":1566,"slug":1567,"type":15},{"name":1657,"slug":1658,"type":15},"Engineering","engineering","2026-07-19T05:38:19.340791",96,{"items":1662,"total":1767},[1663,1675,1682,1689,1697,1703,1711,1717,1723,1733,1746,1757],{"slug":1664,"name":1664,"fn":1665,"description":1666,"org":1667,"tags":1668,"stars":1672,"repoUrl":1673,"updatedAt":1674},"multithreaded-task-migration","migrate MSBuild tasks to multithreaded mode","Guide for migrating MSBuild tasks to multithreaded mode support, including compatibility red-team review. Use this when converting tasks to thread-safe versions, implementing IMultiThreadableTask, adding TaskEnvironment support, or auditing migrations for behavioral compatibility.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1669,1670,1671],{"name":17,"slug":18,"type":15},{"name":1657,"slug":1658,"type":15},{"name":1569,"slug":1570,"type":15},5535,"https:\u002F\u002Fgithub.com\u002Fdotnet\u002Fmsbuild","2026-07-22T05:37:33.965588",{"slug":1556,"name":1556,"fn":1557,"description":1558,"org":1676,"tags":1677,"stars":25,"repoUrl":26,"updatedAt":1571},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1678,1679,1680,1681],{"name":17,"slug":18,"type":15},{"name":1563,"slug":1564,"type":15},{"name":1566,"slug":1567,"type":15},{"name":1569,"slug":1570,"type":15},{"slug":1573,"name":1573,"fn":1574,"description":1575,"org":1683,"tags":1684,"stars":25,"repoUrl":26,"updatedAt":1586},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1685,1686,1687,1688],{"name":17,"slug":18,"type":15},{"name":1580,"slug":1581,"type":15},{"name":1566,"slug":1567,"type":15},{"name":1584,"slug":1585,"type":15},{"slug":1588,"name":1588,"fn":1589,"description":1590,"org":1690,"tags":1691,"stars":25,"repoUrl":26,"updatedAt":1604},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1692,1693,1694,1695,1696],{"name":17,"slug":18,"type":15},{"name":1566,"slug":1567,"type":15},{"name":1596,"slug":1597,"type":15},{"name":1599,"slug":1600,"type":15},{"name":1602,"slug":1603,"type":15},{"slug":1606,"name":1606,"fn":1607,"description":1608,"org":1698,"tags":1699,"stars":25,"repoUrl":26,"updatedAt":1618},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1700,1701,1702],{"name":1563,"slug":1564,"type":15},{"name":1613,"slug":1614,"type":15},{"name":1616,"slug":1617,"type":15},{"slug":1620,"name":1620,"fn":1621,"description":1622,"org":1704,"tags":1705,"stars":25,"repoUrl":26,"updatedAt":1635},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1706,1707,1708,1709,1710],{"name":17,"slug":18,"type":15},{"name":23,"slug":24,"type":15},{"name":1628,"slug":83,"type":15},{"name":1630,"slug":1631,"type":15},{"name":1633,"slug":1634,"type":15},{"slug":1637,"name":1637,"fn":1638,"description":1639,"org":1712,"tags":1713,"stars":25,"repoUrl":26,"updatedAt":1645},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1714,1715,1716],{"name":1563,"slug":1564,"type":15},{"name":1566,"slug":1567,"type":15},{"name":1584,"slug":1585,"type":15},{"slug":1647,"name":1647,"fn":1648,"description":1649,"org":1718,"tags":1719,"stars":25,"repoUrl":26,"updatedAt":1659},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1720,1721,1722],{"name":1653,"slug":1654,"type":15},{"name":1566,"slug":1567,"type":15},{"name":1657,"slug":1658,"type":15},{"slug":1724,"name":1724,"fn":1725,"description":1726,"org":1727,"tags":1728,"stars":25,"repoUrl":26,"updatedAt":1732},"build-parallelism","optimize MSBuild build parallelism","Diagnose and fix under-parallelized MSBuild builds. USE WHEN a multi-project solution build is slower than expected, doesn't speed up when you add cores, pegs a single core while others idle, or you want to know why `-m` isn't helping. Note: `\u002Fmaxcpucount` default is 1 (sequential) — always pass `-m` for parallel builds. Covers finding the critical path (longest serial ProjectReference chain), graph build (`\u002Fgraph`), BuildInParallel, and solution filters (`.slnf`). DO NOT USE FOR: single-project builds, incremental issues (use incremental-build), compilation slowness inside one project (use build-perf-diagnostics), non-MSBuild build systems.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1729,1730,1731],{"name":17,"slug":18,"type":15},{"name":1657,"slug":1658,"type":15},{"name":1569,"slug":1570,"type":15},"2026-07-19T05:38:18.364937",{"slug":1734,"name":1734,"fn":1735,"description":1736,"org":1737,"tags":1738,"stars":25,"repoUrl":26,"updatedAt":1745},"build-perf-baseline","establish and optimize build performance baselines","Establish build performance baselines and apply systematic optimization techniques. USE FOR: diagnosing slow builds, establishing before\u002Fafter measurements (cold, warm, no-op scenarios), applying optimization strategies like MSBuild Server, static graph builds, artifacts output, and dependency graph trimming. Start here before diving into build-perf-diagnostics, incremental-build, or build-parallelism. DO NOT USE FOR: non-MSBuild build systems, detailed bottleneck analysis (use build-perf-diagnostics after baselining).",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1739,1740,1743,1744],{"name":1657,"slug":1658,"type":15},{"name":1741,"slug":1742,"type":15},"Monitoring","monitoring",{"name":1569,"slug":1570,"type":15},{"name":1616,"slug":1617,"type":15},"2026-07-12T08:21:35.865649",{"slug":1747,"name":1747,"fn":1748,"description":1749,"org":1750,"tags":1751,"stars":25,"repoUrl":26,"updatedAt":1756},"build-perf-diagnostics","diagnose MSBuild build performance bottlenecks","Diagnose MSBuild build performance bottlenecks using binary log analysis. USE FOR: identifying why builds are slow by analyzing binlog performance summaries, detecting ResolveAssemblyReference (RAR) taking >5s, Roslyn analyzers consuming >30% of Csc time, single targets dominating >50% of build time, node utilization below 80%, excessive Copy tasks, NuGet restore running every build. Covers timeline analysis, Target\u002FTask Performance Summary interpretation, and 7 common bottleneck categories. Use after build-perf-baseline has established measurements. DO NOT USE FOR: establishing initial baselines (use build-perf-baseline first), fixing incremental build issues (use incremental-build), parallelism tuning (use build-parallelism), non-MSBuild build systems.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1752,1753,1754,1755],{"name":17,"slug":18,"type":15},{"name":1566,"slug":1567,"type":15},{"name":1657,"slug":1658,"type":15},{"name":1569,"slug":1570,"type":15},"2026-07-12T08:21:40.961722",{"slug":1758,"name":1758,"fn":1759,"description":1760,"org":1761,"tags":1762,"stars":25,"repoUrl":26,"updatedAt":1766},"check-bin-obj-clash","detect MSBuild output path conflicts","Detects MSBuild projects with conflicting OutputPath or IntermediateOutputPath. USE FOR: builds failing with 'Cannot create a file when that file already exists', 'The process cannot access the file because it is being used by another process', intermittent build failures that succeed on retry, or missing\u002Foverwritten outputs in multi-project or multi-targeting builds where bin\u002Fobj (or project.assets.json) collide. Common causes: shared OutputPath, missing AppendTargetFrameworkToOutputPath, extra global properties (e.g. PublishReadyToRun), or SetTargetFramework on a ProjectReference to a single-targeting project. DO NOT USE FOR: file access errors unrelated to MSBuild (OS-level locking), single-project single-TFM builds, non-MSBuild build systems.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1763,1764,1765],{"name":1566,"slug":1567,"type":15},{"name":1657,"slug":1658,"type":15},{"name":1613,"slug":1614,"type":15},"2026-07-19T05:38:14.336279",144]