October 31, 2018

Srikaanth

Kaspersky Lab Most Frequently Asked ASP.NET MVC Interview Questions Answers

What Are Scaffold Templates In Asp.net Mvc?

Scaffolding in ASP.NET ASP.Net MVC is used to generate the Controllers,Model and Views for create, read, update, and delete (CRUD) functionality in an application. The scaffolding will be knowing the naming conventions used for models and controllers and views.

Explain The Types Of Scaffoldings?

Below are the types of scaffoldings

Empty
Create
Delete
Details
Edit
List

Can A View Be Shared Across Multiple Controllers? If Yes, How We Can Do That?

Yes we can share a view across multiple controllers. We can put the view in the "Shared" folder. When we create a new ASP.Net MVC Project we can see the Layout page will be added in the shared folder, which is because it is used by multiple child pages.

What Are The Components Required To Create A Route In Asp.net Mvc?

Name - This is the name of the route.

URL Pattern : Placeholders will be given to match the request URL pattern.

Defaults :When loading the application which controller, action to be loaded along with the parameter.

Why To Use "{resource}.axd/{*pathinfo}" In Routing In Asp.net Mvc?

Using this default route - {resource}.axd/{*pathInfo}, we can prevent the requests for the web resources files like - WebResource.axd or ScriptResource.axd from passing to a controller.
Kaspersky Lab Most Frequently Asked ASP.NET MVC Interview Questions Answers
Kaspersky Lab Most Frequently Asked ASP.NET MVC Interview Questions Answers

Can We Add Constraints To The Route? If Yes, Explain How We Can Do It?

Yes we can add constraints to route in following ways

Using Regular Expressions
Using object which implements interface - IRouteConstraint.

What Are The Possible Razor View Extensions?

Below are the two types of extensions razor view can have

.cshtml : In C# programming language this extension will be used.

.vbhtml - In VB programming language this extension will be used.

What Is Partialview In Asp.net Mvc?

PartialView is similar to UserControls in traditional web forms. For re-usability purpose partial views are used. Since it's been shared with multiple views these are kept in shared folder.

Partial Views can be rendered in following ways

Html.Partial()
Html.RenderPartial()

How We Can Add The Css In Asp.net Mvc?

Below is the sample code snippet to add css to razor views : < link rel="StyleSheet" href="/@Href(~Content/Site.css")" type="text/css"/>

Can I Add Asp.net Mvc Testcases In Visual Studio Express?

No. We cannot add the test cases in Visual Studio Express edition it can be added only in Professional and Ultimate versions of Visual Studio.

What Is The Use .glimpse In Asp.net Mvc?

Glimpse is an open source tool for debugging the routes in ASP.Net MVC. It is the client side debugger. Glimpse has to be turned on by visiting to local url link - http://localhost:portname//glimpse.axd This is a popular and useful tool for debugging which tracks the speed details, url details etc.

What Are Model Binders In Asp.net Mvc?

For Model Binding we will use class called : "ModelBinders", which gives access to all the model binders in an application. We can create a custom model binders by inheriting "IModelBinder".

How We Can Handle The Exception At Controller Level In Asp.net Mvc?

Exception Handling is made simple in ASP.Net MVC and it can be done by just overriding "OnException" and set the result property of the filtercontext object (as shown below) to the view detail, which is to be returned in case of exception.

protected overrides void OnException(ExceptionContext filterContext)

    {

    }

How We Can Invoke Child Actions In Asp.net Mvc?

"ChildActionOnly" attribute is decorated over action methods to indicate that action method is a child action. Below is the code snippet used to denote the child action

[ChildActionOnly]

public ActionResult MenuBar()

{

//Logic here

return PartialView();

}

What Is Dependency Injection In Asp.net Mvc?

it's a design pattern and is used for developing loosely couple code. This is greatly used in the software projects. This will reduce the coding in case of changes on project design so this is vastly used.

Subscribe to get more Posts :