Sunteți pe pagina 1din 2

What are Action Filters in ASP.NET MVC?

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} ]

What is view model


what is domain model, Presentation Model
Which Layer MVC project is used
What is dependancy Injection
What is repository pattern
what is routing
what are different ways to pass data from views to controller and vice versa
What is difference between @Html.Partial and @Html.RenderPartial ?
Is it possible to share a view across multiple controllers?
What are the different types of filters, in an asp.net mvc application?
1. Authorization filters
2. Action filters
3. Result filters
4. Exception filters
Give an example for Authorization filters in an asp.net mvc application?
1. RequireHttpsAttribute
2. AuthorizeAttribute
NoActionAttribute
Which filter executes first in an asp.net mvc application?
Authorization filter

what are HTML helper


Explain ASP.net MVC pipeline
What are Layouts in ASP.NET MVC
What are differences among ViewData, ViewBag, TempData and Session?
How to determine an action method is invoked by HTTP GET or POST?
Ans. By using HttpMethod property of HttpRequestBase class, you can find out
whether an action is invoked by HTTP GET or POST.
How to restrict an action method to be invoked only by HTTP GET, POST, PUT or DE
LETE?
How to make a Non-Action method in ASP.NET MVC?
Ans. By default, the ASP.NET MVC framework treats all public methods of a contr
oller class as action methods.
If you do not want a public method to be an action method, you must mark that me
thod with the NonActionAttribute attribute.

S-ar putea să vă placă și