Documente Academic
Documente Profesional
Documente Cultură
If we need to apply some specific logic before or after action methods, we use a
ction filters. We can apply these action filters to a controller or a specific c
ontroller action.
Authorize filter can be used to restrict access to a specific user or a role.
OutputCache filter can cache the output of a controller action for a specific du
ration.
Explain Attribute Routing in ASP.NET MVC5
[Route("Products/{productid?}")
Enabling Attribute Routing
To enable attribute routing, call MapMvcAttributeRoutes during configuration.
Optional URI Parameters and Default Values
You can make a URI parameter optional by adding a question mark to the route par
ameter. You can also specify a default value by using the form parameter=value
What is ASP.NET Identity
You can set a common prefix for an entire controller by using the [RoutePrefix]
attribute:
OR
What is use of RoutePrefix attribute
Route Constraints
What is Route Constraints in ASP.NET MVC?
Ans. Route constraints is way to put some validation around the defined route
Route constraints let you restrict how the parameters in the route template are
matched. The general syntax is {parameter:constraint}. For example:
[Route( users/{id:int} ]