M
M
mindgrow2018-02-06 10:27:38
ASP.NET
mindgrow, 2018-02-06 10:27:38

C# ASP.MVC - where does the authorization check and the corresponding routing take place?

Good afternoon!
There is an asp.mvc project in which authorization is implemented.
If the user is not authorized, then he cannot see pages to which only authorized access is possible.
When trying to enter such a page, the user is redirected to the authorization page.
The question is how to find where the authorization check condition and routing to the authorization page are specified.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Peter, 2018-02-06
@mindgrow

So the entire project setup is in class Startup and most likely the url for the authorization page is set there.

app.UseCookieAuthentication(new CookieAuthenticationOptions
{
     AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
     LoginPath = new PathString("/Account/Login"),
...
}

And the authorization condition is set by the attribute for controllers [Authorize]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question