Use dedicated controllers for mixed attributes (#18879)
* Use dedicated controllers for mixed attributes * Update aspnetcore/security/authorization/simple.md Co-authored-by: Pranav K <prkrishn@hotmail.com> Co-authored-by: Pranav K <prkrishn@hotmail.com>pull/18970/head
parent
43ae480ffc
commit
d26d4aad43
|
@ -73,7 +73,7 @@ This would allow only authenticated users to the `AccountController`, except for
|
|||
|
||||
## Authorize attribute and Razor Pages
|
||||
|
||||
The <xref:Microsoft.AspNetCore.Authorization.AuthorizeAttribute> can ***not*** be applied to Razor Page handlers. For example, `[Authorize]` can't be applied to `OnGet`, `OnPost`, or any other page handler.
|
||||
The <xref:Microsoft.AspNetCore.Authorization.AuthorizeAttribute> can ***not*** be applied to Razor Page handlers. For example, `[Authorize]` can't be applied to `OnGet`, `OnPost`, or any other page handler. Consider using an ASP.NET Core MVC controller for pages with different authorization requirements for different handlers.
|
||||
|
||||
The following two approaches can be used to apply authorization to Razor Page handler methods:
|
||||
|
||||
|
|
Loading…
Reference in New Issue