tag:blogger.com,1999:blog-65435068631872607982024-03-13T04:31:11.166-07:00MVC Interview QuestionsUnknownnoreply@blogger.comBlogger5125tag:blogger.com,1999:blog-6543506863187260798.post-84215779738308144602011-11-24T11:53:00.000-08:002013-03-03T02:04:11.714-08:00MVC Interview Questions on razor views<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>What are the 2 popular asp.net mvc view engines?</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">1. Razor</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">2. .aspx</span><br />
<br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>What symbol would you use to denote, the start of a code block in razor views?</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">@</span><br />
<script type="text/javascript"><!--
google_ad_client = "ca-pub-6328538092426311";
/* 300 X 250 MVC IQ */
google_ad_slot = "5213315787";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />
<br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>What symbol would you use to denote, the start of a code block in aspx views?</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><%= %></span><br />
<br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>In razor syntax, what is the escape sequence character for @ symbol?</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">The escape sequence character for @ symbol, is another @ symbol</span><br />
<br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>When using razor views, do you have to take any special steps to proctect your asp.net mvc application from cross site scripting (XSS) attacks?</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">No, by default content emitted using a @ block is automatically HTML encoded to protect from cross site scripting (XSS) attacks.</span><br />
<br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>When using aspx view engine, to have a consistent look and feel, across all pages of the application, we can make use of asp.net master pages. What is asp.net master pages equivalent, when using razor views?</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">To have a consistent look and feel when using razor views, we can make use of layout pages. Layout pages, reside in the shared folder, and are named as _Layout.cshtml</span><br />
<br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>What are sections?</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Layout pages, can define sections, which can then be overriden by specific views making use of the layout. Defining and overriding sections is optional.</span><br />
<br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>What are the file extensions for razor views?</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">1. .cshtml - If the programming lanugaue is C#</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">2. .vbhtml - If the programming lanugaue is VB</span><br />
<br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>How do you specify comments using razor syntax?</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Razor syntax makes use of @* to indicate the begining of a comment and *@ to indicate the end. An example is shown below.</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">@* This is a Comment *@</span><br />
<script type="text/javascript"><!--
google_ad_client = "ca-pub-6328538092426311";
/* 300 X 250 MVC IQ */
google_ad_slot = "5213315787";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>Unknownnoreply@blogger.com9tag:blogger.com,1999:blog-6543506863187260798.post-49720912793448966982011-11-23T12:08:00.000-08:002013-03-03T02:07:36.145-08:00MVC Interview Questions on Filters<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>What is the use of action filters in an MVC application?</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Action Filters allow us to add pre-action and post-action behavior to controller action methods.</span><br />
<br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>If I have multiple filters impleted, what is the order in which these filters get executed?</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>1.</b> Authorization filters</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>2.</b> Action filters</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>3.</b> Response filters</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>4.</b> Exception filters</span><br />
<script type="text/javascript"><!--
google_ad_client = "ca-pub-6328538092426311";
/* 300 X 250 MVC IQ */
google_ad_slot = "5213315787";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />
<br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>What are the different types of filters, in an asp.net mvc application?</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>1.</b> Authorization filters</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>2.</b> Action filters</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>3.</b> Result filters</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>4.</b> Exception filters</span><br />
<br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>Give an example for Authorization filters in an asp.net mvc application?</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>1.</b> RequireHttpsAttribute</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>2.</b> AuthorizeAttribute</span><br />
<br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>Which filter executes first in an asp.net mvc application?</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Authorization filter</span><br />
<br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>What are the levels at which filters can be applied in an asp.net mvc application?</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>1.</b> Action Method</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>2.</b> Controller</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>3.</b> Application</span><br />
<script type="text/javascript"><!--
google_ad_client = "ca-pub-6328538092426311";
/* 300 X 250 MVC IQ */
google_ad_slot = "5213315787";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />
<br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>Is it possible to create a custom filter?</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Yes</span><br />
<br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>What filters are executed in the end?</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Exception Filters</span><br />
<br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>Is it possible to cancel filter execution?</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Yes</span><br />
<br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>What type of filter does OutputCacheAttribute class represents?</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Result Filter</span>Unknownnoreply@blogger.com5tag:blogger.com,1999:blog-6543506863187260798.post-17602727781100759292011-11-21T13:28:00.000-08:002013-03-03T02:08:47.091-08:00MVC Interview Questions<script type="text/javascript"><!--
google_ad_client = "ca-pub-6328538092426311";
/* 300 X 250 MVC IQ */
google_ad_slot = "5213315787";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<br/><br/>
<a href="http://mvcquestions.blogspot.com/2011/11/basic-mvc-interview-questions.html"><br />
<span style="color: #0066cc; font-family: arial; font-size: 11px; font-weight: bold;">Basic MVC Interview Questions</span></a><br />
<a href="http://mvcquestions.blogspot.com/2011/11/mvc-interview-questions-on-routing.html"><br />
<span style="color: #0066cc; font-family: arial; font-size: 11px; font-weight: bold;">MVC Interview Questions on Routing</span></a><br />
<a href="http://mvcquestions.blogspot.com/2011/11/mvc-interview-questions-on-filters.html"><br />
<span style="color: #0066cc; font-family: arial; font-size: 11px; font-weight: bold;">MVC Interview Questions on Filters</span></a><br />
<a href="http://mvcquestions.blogspot.com/2011/11/mvc-interview-questions-on-razor-views.html"><br />
<span style="color: #0066cc; font-family: arial; font-size: 11px; font-weight: bold;">MVC Interview Questions on razor views</span>
</a>
<br/><br/>
<script type="text/javascript"><!--
google_ad_client = "ca-pub-6328538092426311";
/* 300 X 250 MVC IQ */
google_ad_slot = "5213315787";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>Unknownnoreply@blogger.com44tag:blogger.com,1999:blog-6543506863187260798.post-27563372334431181152011-11-21T13:05:00.000-08:002013-03-03T02:10:42.615-08:00MVC Interview Questions on Routing<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>What is the significance of ASP.NET routing?</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">ASP.NET MVC uses ASP.NET routing, to map incoming browser requests to controller action methods. ASP.NET Routing makes use of route table. Route table is created when your web application first starts. <b>The route table is present in the Global.asax file.</b></span><br />
<br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>What are the 3 segments of the default route, that is present in an ASP.NET MVC application?</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>1st</b> Segment - Controller Name</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>2nd</b> Segment - Action Method Name</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>3rd</b> Segment - Parameter that is passed to the action method</span><br />
<br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>Example:</b> http://pragimtech.com/Customer/Details/5</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Controller Name = Customer</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Action Method Name = Details</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Parameter Id = 5</span><br />
<script type="text/javascript"><!--
google_ad_client = "ca-pub-6328538092426311";
/* 300 X 250 MVC IQ */
google_ad_slot = "5213315787";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>ASP.NET MVC application, makes use of settings at 2 places for routing to work correctly. What are these 2 places?</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>1.</b> Web.Config File : ASP.NET routing has to be enabled here.</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>2.</b> Global.asax File : The Route table is created in the application Start event handler, of the Global.asax file.</span><br />
<br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>What is the adavantage of using ASP.NET routing?</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">In an ASP.NET web application that does not make use of routing, an incoming browser request should map to a physical file. If the file does not exist, we get page not found error.</span><br />
<br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">An ASP.NET web application that does make use of routing, makes use of URLs that do not have to map to specific files in a Web site. Because the URL does not have to map to a file, you can use URLs that are descriptive of the user's action and therefore are more easily understood by users.</span><br />
<br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>What are the 3 things that are needed to specify a route?</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>1. URL Pattern</b> - You can include placeholders in a URL pattern so that variable data can be passed to the request handler without requiring a query string.</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>2. Handler</b> - The handler can be a physical file such as an .aspx file or a controller class.</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>3. Name for the Route</b> - Name is optional.</span><br />
<br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>Is the following route definition a valid route definition?</b></span><br />
<span class="Apple-style-span" style="color: blue; font-family: Arial, Helvetica, sans-serif;"><b>{controller}{action}/{id}</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">No, the above definition is not a valid route definition, because there is no literal value or delimiter between the placeholders. Therefore, routing cannot determine where to separate the value for the controller placeholder from the value for the action placeholder.</span><br />
<br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>What is the use of the following default route?</b></span><br />
<span class="Apple-style-span" style="color: blue; font-family: Arial, Helvetica, sans-serif;"><b>{resource}.axd/{*pathInfo}</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">This route definition, prevent requests for the Web resource files such as WebResource.axd or ScriptResource.axd from being passed to a controller.</span><br />
<script type="text/javascript"><!--
google_ad_client = "ca-pub-6328538092426311";
/* 300 X 250 MVC IQ */
google_ad_slot = "5213315787";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>What is the difference between adding routes, to a webforms application and to an mvc application?</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">To add routes to a <b>webforms application</b>, we use <b>MapPageRoute()</b> method of the RouteCollection class, where as to add routes to an <b>MVC application</b> we use <b>MapRoute()</b> method.</span><br />
<br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>How do you handle variable number of segments in a route definition?</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Use a route with a <b><span class="Apple-style-span" style="color: #660000;">catch-all</span></b> parameter. An example is shown below. <b><span class="Apple-style-span" style="color: #660000;">*</span></b> is referred to as <b><span class="Apple-style-span" style="color: #660000;">catch-all</span></b> parameter.</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>controller/{action}/{*parametervalues}</b></span><br />
<br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>What are the 2 ways of adding constraints to a route?</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>1.</b> Use regular expressions</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>2.</b> Use an object that implements IRouteConstraint interface</span><br />
<br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>Give 2 examples for scenarios when routing is not applied?</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>1. A Physical File is Found that Matches the URL Pattern</b> - This default behaviour can be overriden by setting the RouteExistingFiles property of the RouteCollection object to true.</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>2. Routing Is Explicitly Disabled for a URL Pattern</b> - Use the RouteCollection.Ignore() method to prevent routing from handling certain requests.</span>Unknownnoreply@blogger.com4tag:blogger.com,1999:blog-6543506863187260798.post-14759214609077161622011-11-19T09:30:00.000-08:002013-03-03T02:06:16.047-08:00Basic MVC Interview Questions<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>What are the 3 main components of an ASP.NET MVC application?</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">1. <b>M</b> - <b>M</b>odel</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">2. <b>V</b> - <b>V</b>iew</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">3. <b>C</b> - <b>C</b>ontroller</span><br />
<br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>In which assembly is the MVC framework defined?</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">System.Web.Mvc</span><br />
<script type="text/javascript"><!--
google_ad_client = "ca-pub-6328538092426311";
/* 300 X 250 MVC IQ */
google_ad_slot = "5213315787";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>Is it possible to combine ASP.NET webforms and ASP.MVC and develop a single web application?</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>Yes</b>, it is possible to combine ASP.NET webforms and ASP.MVC and develop a single web application.</span><br />
<br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>What does Model, View and Controller represent in an MVC application?</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>Model:</b> Model represents the application data domain. In short the applications business logic is contained with in the model.</span><br />
<br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>View:</b> Views represent the user interface, with which the end users interact. In short the all the user interface logic is contained with in the UI.</span><br />
<br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>Controller:</b> Controller is the component that responds to user actions. Based on the user actions, the respective controller, work with the model, and selects a view to render that displays the user interface. The user input logic is contained with in the controller.</span><br />
<br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>What is the greatest advantage of using asp.net mvc over asp.net webforms?</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">It is difficult to unit test UI with webforms, where views in mvc can be very easily unit tested.</span><br />
<br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>Which approach provides better support for test driven development - ASP.NET MVC or ASP.NET Webforms?</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">ASP.NET MVC</span><br />
<br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>What are the advantages of ASP.NET MVC?</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">1. Extensive support for TDD. With asp.net MVC, views can also be very easily unit tested.</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">2. Complex applications can be easily managed</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">3. Seperation of concerns. Different aspects of the application can be divided into Model, View and Controller.</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">4. ASP.NET MVC views are light weight, as they donot use viewstate.</span><br />
<script type="text/javascript"><!--
google_ad_client = "ca-pub-6328538092426311";
/* 300 X 250 MVC IQ */
google_ad_slot = "5213315787";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>Is it possible to unit test an MVC application without running the controllers in an ASP.NET process?</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Yes, all the features in an asp.net MVC application are interface based and hence mocking is much easier. So, we don't have to run the controllers in an ASP.NET process for unit testing.</span><br />
<br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>Is it possible to share a view across multiple controllers?</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Yes, put the view into the shared folder. This will automatically make the view available across multiple controllers.</span><br />
<br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>What is the role of a controller in an MVC application?</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">The controller responds to user interactions, with the application, by selecting the action method to execute and alse selecting the view to render.</span><br />
<br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>Where are the routing rules defined in an asp.net MVC application?</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">In Application_Start event in Global.asax</span><br />
<br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>Name a few different return types of a controller action method?</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">The following are just a few return types of a controller action method. In general an action method can return an instance of a any class that derives from ActionResult class.</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">1. ViewResult</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">2. JavaScriptResult</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">3. RedirectResult</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">4. ContentResult</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">5. JsonResult</span><br />
<br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>What is the significance of NonActionAttribute?</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">In general, all public methods of a controller class are treated as action methods. If you want prevent this default behaviour, just decorate the public method with NonActionAttribute.</span>Unknownnoreply@blogger.com21