What is the Order
parameter in the Asp.NET Authorization%% Attribute?
How do you use it?
What is the Order
parameter in the Asp.NET Authorization%% Attribute?
How do you use it?
According to the MSDN , it indicates the order in which the attribute will run, from the filters that are configured in the pipeline of the MVC ( IMvcFilter
). If the only filter you have is [Authorize]
, then the value of the attribute does not matter. If you have more than one, then it can set the order that the authorization logic will be executed.
For example, if you have a filter that logs all requests to your controller. If the order of the authorization attribute causes it to run before the logger , then rejected requests will not be logged in ; otherwise they will be logged in.