ASP.NET Interview Questions and Answers Set 10

91. Explain the types of Scaffoldings.

Below are the types of scaffoldings –

  • Empty
  • Create
  • Delete
  • Details
  • Edit
  • List

92. 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 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.

93. What are the components required to create a route in 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.

94. Why to use “{resource}.axd/{*pathInfo}” in routing in 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.

95. 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.



96. 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.

97.  What is PartialView in 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()

98. How we can add the CSS in MVC?

Below is the sample code snippet to add css to razor views –

<link rel=”StyleSheet” href=”/@Href(~Content/Site.css”)” type=”text/css”/>

99. Can I add 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.

100. What is the use .Glimpse in MVC?

Glimpse is an open source tool for debugging the routes in 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.


Asp Dot Net Interview Questions And Answers