Skip to content

Commit b6813e3

Browse files
authored
Add note about MapControllers in ASP.NET Core
MapControllers is not called by default when starting with a new ASP.NET Core Web App that uses Razor Pages. However, since the Microsoft Identity UI uses it, forgetting to add `app.MapControllers()` will cause sign-in and sign-out links to stay blank and manually navigating to `/MicrosoftIdentity/Account/SignOut` to result in a 404. Considering the documentation already mentions `UseAuthentication` and `AddRazorPages` in the samples, I feel like `MapControllers` should be added as well.
1 parent 51273cf commit b6813e3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

articles/active-directory/develop/scenario-web-app-sign-user-app-configuration.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ To add authentication with the Microsoft identity platform (formerly Azure AD v2
261261
}).AddMicrosoftIdentityUI();
262262
```
263263
264-
3. In the `Configure` method in *Startup.cs*, enable authentication with a call to `app.UseAuthentication();`
264+
3. In the `Configure` method in *Startup.cs*, enable authentication with a call to `app.UseAuthentication();` and `app.MapControllers();`.
265265
266266
```c#
267267
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
@@ -270,6 +270,9 @@ To add authentication with the Microsoft identity platform (formerly Azure AD v2
270270
// more code here
271271
app.UseAuthentication();
272272
app.UseAuthorization();
273+
274+
app.MapRazorPages();
275+
app.MapControllers();
273276
// more code here
274277
}
275278
```

0 commit comments

Comments
 (0)