MVC Interview Questions 1

What is use of ” routes.IgnoreRoute(“{resource}.axd/{*pathInfo}”); in route config?
It is used to restrict access to web resources like WebResource.axd, ScriptResource.axd from request.

What is use of TempData?
TempData is used to pass data to current request and its subsequent request.It data is lost once it it read, we can use Keep() and Peek() method to preserve data in TempData.

What is the use of Child Action in MVC?
Child Action is use to create reusable widgets,that can be only loaded inside a view.ie ChidAction can not be called directly from browser.

What are Filters?
Filters are used to inject logic in MVC request processing pipeline.There are 5 types of filters in MVC5:

  • Authentication Filter
  • Authorization Filter
  • Action filter
  • Result Filter
  • Exception Filter

What is Model Binding?
Process of extracting information from request and mapping it to Model is called Model Binding.MVC framework have default Model binders to perform Model Binding.

  • Request.Form
  • RouteData.Values
  • Request.Querystring
  • Request.Files

What is bundling and minification?
MVC Framework provides feature of bundling the stylesheets and Javascript files into a single file reducing number of loads.Minifiication reduces the size of file by removing spaces and other optimization technique.

What are available Action result types available in MVC5?

  • ViewResult
  • ContentResult
  • PartialViewResult
  • RedirectToRouteResult
  • RedirectResult
  • FileResult
  • JsonResult
  • JavaScriptResult
  • HttpUnauthorizedResult
  • HttpNotFoundResult
  • HttpStatusCodeResult
  • EmptyResult

What is difference between Routing and URL Rewriting?
URL rewriting is basically mapping one URL to other, where as Routing is a MVC framework feature to map incoming request to a resource.

Add a Comment

Your email address will not be published. Required fields are marked *