The Highest Post
Related Topics
  • Explain what is Model-View-Controller?
  • Mention what does Model-View-Controller represent in an MVC application?
  • Explain MVC application life cycle?
  • What is the latest version of MVC?
  • What is the difference between each version of MVC 2, 3 , 4, 5 and 6?
  • Can we map multiple URL’s to the same action?
  • How can we restrict MVC actions to be invoked only by GET or POST?
  • How can we maintain sessions in MVC?
  • What is the difference between tempdata, viewdata, and viewbag?
  • What is difference between TempData and ViewData ?
  • What is the use of Keep and Peek in “TempData”?
  • What are partial views in MVC?
  • So which is a better fit, Razor or ASPX?
  • What is the difference between ActionResult and ViewResult?
  • What are the different types of action filters?
  • Explain minification and how to implement it
  • What is the use of ViewModel in MVC?
  • Explain JSON Binding?
  • Explain Dependency Resolution?
  • Explain Bundle.Config
  • What is the difference between ViewBag and ViewData in MVC?
  • What are HTML Helpers in MVC?
  • What are AJAX Helpers in MVC?
  • What are the options can be configured in AJAX helpers?
  • Explain the methods used to render the views in MVC?
  • What are Non Action methods in MVC?
  • What are Scaffold templates in MVC?
  • Explain the types of Scaffoldings.
  • Can a view be shared across multiple controllers? If Yes, How we can do that?
  • What is the use .Glimpse in MVC?
  • How does the 'page lifecycle' of ASP.Net MVC works
  • What is Dependency Injection?
  • Dependency Injection
  • Explain the types of Scaffoldings.
  • Explain the tools used for unit testing in MVC?
  • List out a few different return types of a controller action method?
  • What does the MVC Pattern define with 3 logical layers?
  • What is MVC Routing?
  • What are the Filters?
  • What are the MVC action filter types?
  • Can you explain the page life cycle of MVC?
  • What do you mean by MVC Scaffolding?
  • Explain the concept of Razor in ASP.NET MVC?
  • Explain the concept of Default Route in MVC
  • 20. What is GET and POST Action types?
  • 20. What is GET and POST Action types?
  • Mention the Benefits of Area in MVC
  • Mention what are the two ways for adding constraints to a route?
  • How can we implement validation in MVC?
  • Mention two instances where routing is not implemented or required?
  • What is the use of Keep and Peek in “TempData”?
  • What is a glimpse?
  • How can we navigate from one view to another using a hyperlink?
  • How do you observe stronger security in MVC?
  • How to do perform better as a MVC lead guy?
  • What is the difference between response.redirect and server.transfer?
  • What is ASP.NET MVC Routing?
  • What is Strongly typed views?
  • What are the benefits of a strongly typed view in ASP NET MVC?
  • What is ViewModel in MVC C#?
  • What is ViewModel in MVC C#?
  • How many types of views are there in MVC?
  • What is AuthConfig Cs in MVC?
  • What is the purpose of ViewModel?
  • What is IIS server and how it works?
  • What is a Controller in MVC?
  • What is public methods of the Controller called?
  • what is default action method for Controller?
  • Mention some of the ActionVerbs selector which handle different type of Http requests
  • How is other way error handle in MVC 5?
  • What is TempData?
  • What is MVC Filter
  • What is OutputCache?
  • What isAction Filters
  • What are HtmlHelpers?
  • What way ASP.NET provides some ways to handle exceptions?
  • Mention what is the difference between Temp data, View, and View Bag?
  • Mention what is the difference between adding routes, to a webform application and an MVC application?
  • Mention what are the two ways to add constraints to a route?
  • Mention what "beforFilter()","beforeRender" and "afterFilter" functions do in Controller?
  • What are Actionfilters in MVC?
  • What is scaffolding in MVC?
  • What is routing in MVC?
  • Can you explain RenderBody and RenderPage in MVC?
  • What is scaffold DbContext?
  • What is an API route?
  • What is MVC Razor?
  • What is Viewstart MVC?
  • What is Section in MVC?
  • What is scaffolding database?
  • Why we use action filters in MVC?
  • What is Action Filter?
  • Which filter execute first in MVC?
  • Difference Between ViewResult() and ActionResult()
  • MVC Top questions

    Find by name:


    New Post

    Recent Post

    • Peter Agyekum Explain what is Model-View-Controller?

      MVC is a software architecture pattern for developing web application. It is handled by three objects Model-View-Controller.

      Peter Agyekum Mention what does Model-View-Controller represent in an MVC application?


      • In an MVC model, :
      • Model- It represents the application data domain. In other words applications business logic is contained within the model and is responsible for maintaining data

      • View- It represents the user interface, with which the end users communicates. In short all the user interface logic is contained within the VIEW

      • Controller- It is the controller that answers to user actions. Based on the user actions, the respective controller responds within the model and choose a view to render that display the user interface. The user input logic is contained with-in the controller


      Peter Agyekum Explain MVC application life cycle?

      Step 1 Fill route: - MVC requests are mapped to route tables which in turn specify which controller and action to be invoked. So if the request is the first request the first thing is to fill the route table with routes collection. This filling of route table happens in the global.asax file. Step 2 Fetch route: - Depending on the URL sent “UrlRoutingModule” searches the route table to create “RouteData” object which has the details of which controller and action to invoke. Step 3 Request context created: - The “RouteData” object is used to create the “RequestContext” object. Step 4 Controller instance created: - This request object is sent to “MvcHandler” instance to create the controller class instance. Once the controller class object is created it calls the “Execute” method of the controller class. Creating Response object: - This phase has two steps executing the action and finally sending the response as a result to the view.

      Peter Agyekum What is the latest version of MVC?

      MVC 6 is the latest version which is also termed as ASP VNEXT.

      Peter Agyekum What is the difference between each version of MVC 2, 3 , 4, 5 and 6?

      MVC 6 ASP.NET MVC and Web API has been merged in to one. Dependency injection is inbuilt and part of MVC. Side by side - deploy the runtime and framework with your application Everything packaged with NuGet, Including the .NET runtime itself. New JSON based project structure. No need to recompile for every change. Just hit save and refresh the browser. Compilation done with the new Roslyn real-time compiler. vNext is Open Source via the .NET Foundation and is taking public contributions. vNext (and Rosyln) also runs on Mono, on both Mac and Linux today. MVC 5 One ASP.NET Attribute based routing Asp.Net Identity Bootstrap in the MVC template Authentication Filters Filter overrides MVC 4 ASP.NET Web API Refreshed and modernized default project templates New mobile project template Many new features to support mobile apps Enhanced support for asynchronous methods MVC 3 Razor Readymade project templates HTML 5 enabled templates Support for Multiple View Engines JavaScript and Ajax Model Validation Improvements MVC 2 Client-Side Validation Templated Helpers Areas Asynchronous Controllers Html.ValidationSummary Helper Method DefaultValueAttribute in Action-Method Parameters Binding Binary Data with Model Binders DataAnnotations Attributes Model-Validator Providers New RequireHttpsAttribute Action Filter Templated Helpers Display Model-Level Errors

      Peter Agyekum Can we map multiple URL’s to the same action?

      Yes, you can, you just need to make two entries with different key names and specify the same controller and action.

      Peter Agyekum How can we restrict MVC actions to be invoked only by GET or POST?

      We can decorate the MVC action with the HttpGet or HttpPost attribute to restrict the type of HTTP calls

      Peter Agyekum How can we maintain sessions in MVC?

      Sessions can be maintained in MVC by three ways: tempdata, viewdata, and viewbag.

      Peter Agyekum What is the difference between tempdata, viewdata, and viewbag?

      Temp data - Helps to maintain data when you move from one controller to another controller or from one action to another action. In other words when you redirect, tempdata helps to maintain data between those redirects. It internally uses session variables. View data - Helps to maintain data when you move from controller to view. View Bag - It’s a dynamic wrapper around view data. When you use Viewbag type, casting is not required. It uses the dynamic keyword internally.

      Peter Agyekum What is difference between TempData and ViewData ?

      “TempData” maintains data for the complete request while “ViewData” maintains data only from Controller to the view.

      Peter Agyekum What is the use of Keep and Peek in “TempData”?

      Once “TempData” is read in the current request it’s not available in the subsequent request. If we want “TempData” to be read and also available in the subsequent request then after reading we need to call “Keep” method as shown in the code below. @TempData["MyData"]; TempData.Keep("MyData");

      Peter Agyekum What are partial views in MVC?

      Partial view is a reusable view (like a user control) which can be embedded inside other view. For example let’s say all your pages of your site have a standard structure with left menu, header, and footer as shown in the image below.

      Peter Agyekum So which is a better fit, Razor or ASPX?

      Razor is clean, lightweight, and syntaxes are easy as compared to ASPX. For example, in ASPX to display simple time, we need to write:

      Peter Agyekum What is the difference between ActionResult and ViewResult?

      ActionResult is an abstract class while ViewResult derives from the ActionResult class. ActionResult has several derived classes like ViewResult, JsonResult, FileStreamResult, and so on. ActionResult can be used to exploit polymorphism and dynamism. So if you are returning different types of views dynamically, ActionResult is the best thing. For example in the below code snippet, you can see we have a simple action called DynamicView. Depending on the flag (IsHtmlView) it will either return a ViewResult or JsonResult.

      Peter Agyekum What are the different types of action filters?

      Authorization filters Action filters Result filters Exception filters

      Peter Agyekum Explain minification and how to implement it

      Minification reduces the size of script and CSS files by removing blank spaces , comments etc. For example below is a simple javascript code with comments.

      Peter Agyekum What is the use of ViewModel in MVC?

      ViewModel is a plain class with properties, which is used to bind it to strongly typed view. ViewModel can have the validation rules defined for its properties using data annotations.

      Peter Agyekum Explain JSON Binding?

      JavaScript Object Notation (JSON) binding support started from MVC3 onwards via the new JsonValueProviderFactory, which allows the action methods to accept and model-bind data in JSON format. This is useful in Ajax scenarios like client templates and data binding that need to post data back to the server.

      Peter Agyekum Explain Dependency Resolution?

      Dependency Resolver again has been introduced in MVC3 and it is greatly simplified the use of dependency injection in your applications. This turn to be easier and useful for decoupling the application components and making them easier to test and more configurable.

      Peter Agyekum Explain Bundle.Config

      Is used to register the bundles by the bundling and minification system. Many bundles are added by default including jQuery libraries like — jquery.validate, Modernizr, and default CSS references.

      Peter Agyekum What is the difference between ViewBag and ViewData in MVC?

      ViewBag is a wrapper around ViewData, which allows to create dynamic properties. Advantage of viewbag over viewdata will be – In ViewBag no need to typecast the objects as in ViewData. ViewBag will take advantage of dynamic keyword which is introduced in version 4.0. But before using ViewBag we have to keep in mind that ViewBag is slower than ViewData.

      Peter Agyekum What are HTML Helpers in MVC?

      HTML Helpers are like controls in traditional web forms. But HTML helpers are more lightweight compared to web controls as it does not hold viewstate and events. HTML Helpers returns the HTML string which can be directly rendered to HTML page. Custom HTML Helpers also can be created by overriding “HtmlHelper” class.

      Peter Agyekum What are AJAX Helpers in MVC?

      AJAX Helpers are used to create AJAX enabled elements like as Ajax enabled forms and links which performs the request asynchronously and these are extension methods of AJAXHelper class which exists in namespace — System.Web.Mvc.

      Peter Agyekum What are the options can be configured in AJAX helpers?

      Below are the options in AJAX helpers – Url — This is the request URL. Confirm — This is used to specify the message which is to be displayed in confirm box. OnBegin — Javascript method name to be given here and this will be called before the AJAX request. OnComplete — Javascript method name to be given here and this will be called at the end of AJAX request. OnSuccess — Javascript method name to be given here and this will be called when AJAX request is successful. OnFailure — Javascript method name to be given here and this will be called when AJAX request is failed. UpdateTargetId — Target element which is populated from the action returning HTML.

      Peter Agyekum Explain the methods used to render the views in MVC?

      Below are the methods used to render the views from action - View() — To return the view from action. PartialView() — To return the partial view from action. RedirectToAction() — To Redirect to different action which can be in same controller or in different controller. Redirect() — Similar to “Response.Redirect()” in webforms, used to redirect to specified URL. RedirectToRoute() — Redirect to action from the specified URL but URL in the route table has been matched.

      Peter Agyekum What are Non Action methods in MVC?

      In MVC all public methods have been treated as Actions. So if you are creating a method and if you do not want to use it as an action method then the method has to be decorated with “NonAction” attribute as shown below – [NonAction] public void TestMethod() { // Method logic }

      Peter Agyekum What are Scaffold templates in MVC?

      Scaffolding in 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.

      Peter Agyekum Explain the types of Scaffoldings.

      Below are the types of scaffoldings – Empty Create Delete Details Edit List

      Peter Agyekum 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.

      Peter Agyekum 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

      Peter Agyekum How does the 'page lifecycle' of ASP.Net MVC works

      Below are the processed followed in the sequence - App initializWhat is Separation of Concerns in ASP.NET ASP.Net MVCation Routing Instantiate and execute controller Locate and invoke controller action Instantiate and render view.

      Peter Agyekum What is Dependency Injection?

      Dependency Injection is a way to implement the Dependency Inversion Principle. Simply put, Dependency Injection is a design pattern that helps a class separate the logic of creating dependent objects. The result of this separation is a loosely coupled system where there is no rigid dependency between two concrete implementations.

      Peter Agyekum Dependency Injection

      Dependency Injection (DI) is a design pattern that takes away the responsibility of creating dependencies from a class thus resulting in a loosely coupled system. In order to understand DI you need to be aware of the following terms:

      Peter Agyekum Explain the types of Scaffoldings.

      Empty Create Delete Details Edit List

      Peter Agyekum Explain the tools used for unit testing in MVC?

      Below are the tools used for unit testing – NUnit xUnit.NET Ninject 2 Moq

      Peter Agyekum List out a few different return types of a controller action method?

      View Result, Javascript Result, Redirect Result, JSON Result, Content Result

      Peter Agyekum What does the MVC Pattern define with 3 logical layers?

      The business layer (Model logic), The display layer (View logic), The input control (Controller logic),

      Peter Agyekum What is MVC Routing?

      The URLs in ASP.NET MVC are mapped to action methods and controller instead of physical files of the system. To accurately map action methods and controller to URLs, the routing engine forms appropriate routes. Using this, the controllers can handle specific requests.

      Peter Agyekum What are the Filters?

      . Filters define the logic which is executed before or after the execution of the action method.

      Peter Agyekum What are the MVC action filter types?

      Authorization filter (implements IAuthorizationFilter) Action filter (implements IActionFilter) Result filter (implements IResultFilter) Exception filter (implementsIExceptionFilter attribute)

      Peter Agyekum Can you explain the page life cycle of MVC?

      App initialization Routing Instantiate and execute controller Locate and invoke controller action Instantiate and render view.

      Peter Agyekum What do you mean by MVC Scaffolding?

      Scaffolding is a code generation framework for ASP.NET Web applications. Visual Studio includes pre-installed code generators for MVC and Web API projects. You add scaffolding to your project when you want to quickly add the code that interacts with data models. Using scaffolding can reduce the amount of time to develop standard data operations in your project.

      Peter Agyekum Explain the concept of Razor in ASP.NET MVC?

      ASP.NET MVC has always supported the concept of “view engines” – which are the pluggable modules that implement different template syntax options. The “default” view engine for ASP.NET MVC uses the same .aspx/.ascx/. or .cshtml

      Peter Agyekum Explain the concept of Default Route in MVC

      This route pattern is registered via a call to the MapRoute() extension method of RouteCollection. URL: "{controller}/{action}/{id}"

      Peter Agyekum 20. What is GET and POST Action types?

      GET Action Type: GET is used to request data from a specified resource. With all the GET requests, we pass the URL, which is compulsory; however, it can take up the following overloads.

      Peter Agyekum 20. What is GET and POST Action types?

      GET Action Type: GET is used to request data from a specified resource. With all the GET requests, we pass the URL, which is compulsory; however, it can take up the following overloads. POST Action Type: Tthe POST is used to submit data to be processed to a specified resource. With all the POST requests, we pass the URL, which is essential and the data. However, it can take up the following overloads.

      Peter Agyekum Mention the Benefits of Area in MVC

      It allows us to organize models, views, and controllers into separate functional sections of the application, such as administration, billing, customer support and much more. It is easy to integrate with other Areas created by another. Also, easy for unit testing.

      Peter Agyekum Mention what are the two ways for adding constraints to a route?

      Using regular expressions Using an object that implements IRouteConstraint interface

      Peter Agyekum How can we implement validation in MVC?

      We can easily implement validation in MVC application by using the validators defined in the System.ComponentModel.DataAnnotations namespace. There are different types of validators as follows: Required DataType Range StringLength

      Peter Agyekum Mention two instances where routing is not implemented or required?

      When a physical file is found that matches the URL pattern When routing is disabled for a URL pattern

      Peter Agyekum What is the use of Keep and Peek in “TempData”?

      Once “TempData” is read in the current request, it’s not available in the subsequent request. If we want “TempData” to be read and also available in the subsequent request then after reading we need to call “Keep” method as shown in the code below. @TempData["MyData"]; TempData.Keep("MyData"); The more shortcut way of achieving the same is by using “Peek”. This function helps to read as well advices MVC to maintain “TempData” for the subsequent request. string str = TempData.Peek("Td").ToString();

      Peter Agyekum What is a glimpse?

      Glimpse is NuGet packages which help in finding performance, debugging and diagnostic information. Glimpse can help you get information about timelines, model binding, routes, environment, etc.

      Peter Agyekum How can we navigate from one view to another using a hyperlink?

      40. How can we navigate from one view to another using a hyperlink?

      Peter Agyekum How do you observe stronger security in MVC?

      Always authenticate APIs before Authorizing. Always Use HTTPS. ... Use the Password Hash and encriptions. ... Validation Inputs on textboxes Never expose information on URLs. ...

      Peter Agyekum How to do perform better as a MVC lead guy?

      I will accept and welcome questions opinion or feedback 2 Communicate and keep your team fully informed of project goals, priorities, and those all-important deadlines. 3 Set a good example and dedication that you would expect from others. 5) I will create a friendly environment of learning and rewarding new innovative ideas. That will confidence but encourage future contributions and effort. 7) I will seek guidance from the Managers and Staff Members.

      Peter Agyekum What is the difference between response.redirect and server.transfer?

      The Response. Redirect method redirects a request to a new URL and specifies the new URL while the Server.Transfer method for the current request, terminates execution of the current page and starts execution of a new page using the specified URL path of the page

      Peter Agyekum What is ASP.NET MVC Routing?

      ASP.NET MVC routing is a pattern matching system that is responsible for mapping incoming browser requests to specified MVC controller actions. When the ASP.NET MVC application launches then the application registers one or more patterns with the framework's route table to tell the routing engine what to do with any requests that matches those patterns. When the routing engine receives a request at runtime, it matches that request's URL against the URL patterns registered with it and gives the response according to a pattern match

      Peter Agyekum What is Strongly typed views?

      Strongly typed views are used for rendering specific types of model objects, instead of using the general ViewData structure. By specifying the type of data, you get access to IntelliSense for the model class.

      Peter Agyekum What are the benefits of a strongly typed view in ASP NET MVC?

      IntelliSense Help, Compile time error checking, You do not have to cast between types,

      Peter Agyekum What is ViewModel in MVC C#?

      In ASP.NET MVC, ViewModel is a class that contains the fields which are represented in the strongly-typed view. It is used to pass data from controller to strongly-typed view.

      Peter Agyekum What is ViewModel in MVC C#?

      In ASP.NET MVC, ViewModel is a class that contains the fields which are represented in the strongly-typed view. It is used to pass data from controller to strongly-typed view.

      Peter Agyekum How many types of views are there in MVC?

      On basis of data transfer mechanism ASP.NET MVC views are categorized as two types, Dynamic view. Strongly typed view.

      Peter Agyekum What is AuthConfig Cs in MVC?

      AuthConfig.cs - settings in this file allows you to login to ASP.NET MVC site using third party client credentials like fb account,google account,yahoo account etc..or you can register also. BundleConfig.cs: settings in this file allows to improve the performance of an applications using bundling

      Peter Agyekum What is the purpose of ViewModel?

      The purpose of ViewModel is to encapsulate the data for a UI controller to let the data survive configuration changes. For information about how to load, persist, and manage data across configuration changes, see Saving UI States.

      Peter Agyekum What is IIS server and how it works?

      Internet Information Services (IIS) is a flexible, general-purpose web server from Microsoft that runs on Windows systems to serve requested HTML pages or files. An IIS web server accepts requests from remote client computers and returns the appropriate response.

      Peter Agyekum What is a Controller in MVC?

      The Controller in MVC architecture handles any incoming URL request. The Controller is a class, derived from the base class System.Web.Mvc.Controller. Controller class contains public methods called Action methods. Controller and its action method handles incoming browser requests, retrieves necessary model data and returns appropriate responses.

      Peter Agyekum What is public methods of the Controller called?

      Action methods. They are like any other normal methods with the following restrictions: Action method must be public. It cannot be private or protected Action method cannot be overloaded Action method cannot be a static method.

      Peter Agyekum what is default action method for Controller?

      Index. method is public, and it returns the ActionResult using the View() method.

      Peter Agyekum Mention some of the ActionVerbs selector which handle different type of Http requests

      ActionVerbs: HttpGet, HttpPost, HttpPut

      Peter Agyekum How is other way error handle in MVC 5?

      The customErrors section can be used for handling exceptions at the ASP.NET application level. There is an IIS web server between users and the application under system.webServer in web.config. example remove statusCode=404. The above httpErrors replaces the response coming from ASP.NET with the matching status code and return a custom HTML file as a response. This will preserve the URL and return a custom error page with an appropriate error code. To make the above config work, create 500.html, 404.html, 400.html at the root of the application. The following is 404.html file.

      Peter Agyekum What is TempData?

      TempData is used to transfer data from view to controller, controller to view, or from one action method to another action method of the same or a different controller.

      Peter Agyekum What is MVC Filter

      Filter Performs authentication and authorizes before executing an action method. eg. Authorization Filter

      Peter Agyekum What is OutputCache?

      OutputCache is a built-in action filter attribute that can be applied to an action method for which we want to cache the output. For example, the output of the following action method will be cached for 100 seconds.

      Peter Agyekum What isAction Filters

      Action filter executes before and after an action method executes. Action filter attributes can be applied to an individual action method or to a controller. When an action filter is applied to a controller, it will be applied to all the controller's action methods

      Peter Agyekum What are HtmlHelpers?

      HtmlHelper class renders HTML controls in the razor view. It binds the model object to HTML controls to display the value of model properties into those controls and also assigns the value of the controls to the model properties while submitting a web form.

      Peter Agyekum What way ASP.NET provides some ways to handle exceptions?

      Using customErrors element in web.config, Using HandleErrorAttribute, Overriding Controller.OnException method, Using Application_Error event of HttpApplication,

      Peter Agyekum Mention what is the difference between Temp data, View, and View Bag?

      Temp data: It helps to maintain data when you shift from one controller to other controller. View data: It helps to maintain data when you move from controller to view View Bag: It's a dynamic wrapper around view data

      Peter Agyekum Mention what is the difference between adding routes, to a webform application and an MVC application?

      To add routes to a webform application, we can use MapPageRoute() method of the RouteCollection class, where adding routes to an MVC application, you can use MapRoute() method.

      Peter Agyekum Mention what are the two ways to add constraints to a route?

      . Use regular expressions, . Use an object that implements IRouteConstraint Interface

      Peter Agyekum Mention what "beforFilter()","beforeRender" and "afterFilter" functions do in Controller?

      beforeFilter(): This function is run before every action in the controller. It's the right place to check for an active session or inspect user permissions. beforeRender(): This function is called after controller action logic, but before the view is rendered. This function is not often used, but may be required If you are calling render() manually before the end of a given action afterFilter(): This function is called after every controller action, and after rendering is done. It is the last controller method to run

      Peter Agyekum What are Actionfilters in MVC?

      Action Filters are additional attributes that can be applied to either a controller section or the entire controller to modify the way in which an action is executed. These attributes are special . NET classes derived from System. Attribute which can be attached to classes, methods, properties, and fields.

      Peter Agyekum What is scaffolding in MVC?

      ASP.NET Scaffolding is a code generation framework for ASP.NET Web applications. Visual Studio 2013 includes pre-installed code generators for MVC and Web API projects. You add scaffolding to your project when you want to quickly add code that interacts with data models.

      Peter Agyekum What is routing in MVC?

      In MVC, routing is a process of mapping the browser request to the controller action and return response back. Each MVC application has default routing for the default HomeController. We can set custom routing for newly created controller. The RouteConfig. cs file is used to set routing for the application.

      Peter Agyekum Can you explain RenderBody and RenderPage in MVC?

      The RenderBody method indicates where view templates that are based on this master layout file should “fill in” the body content. Layout pages can also contain content that can be filled by other pages on disk. This is achieved by using the RenderPage method. This method takes either one or two parameters.

      Peter Agyekum What is scaffold DbContext?

      Reverse engineering is the process of scaffolding entity type classes and a DbContext class based on a database schema. It can be performed using the Scaffold-DbContext command of the EF Core Package Manager Console (PMC) tools or the dotnet ef dbcontext scaffold command of the . NET Command-line Interface (CLI) tools.

      Peter Agyekum What is an API route?

      Web API routing is similar to ASP.NET MVC Routing. It routes an incoming HTTP request to a particular action method on a Web API controller. Web API supports two types of routing: Convention-based Routing.

      Peter Agyekum What is MVC Razor?

      ASP.NET MVC Razor is a template engine for markup syntax that lets you embed server-based code into web pages using C# and VB.Net. It is not a programming language. It is a server side markup language.

      Peter Agyekum What is Viewstart MVC?

      cshtml page is a special view page containing the statement declaration to include the Layout page. Instead of declaring the Layout page in every view page, we can use the _ViewStart page. When a View Page Start is running, the “_ViewStart.

      Peter Agyekum What is Section in MVC?

      You want to use sections when you want a bit of code/content to render in a placeholder that has been defined in a layout page. ... Any view that uses that layout can define an @section of the same name as defined in Layout, and it will replace the RenderSection call in the layout.

      Peter Agyekum What is scaffolding database?

      Scaffolding inspects an existing database and creates a data model automatically.

      Peter Agyekum Why we use action filters in MVC?

      Action filters are used to implement the logic that get executed before or after a controller action executes. Result filters contains logic that gets executed before or after a view result gets executed

      Peter Agyekum What is Action Filter?

      Action filters are used to implement the logic that get executed before or after a controller action executes. Result filters contains logic that gets executed before or after a view result gets executed

      Peter Agyekum Which filter execute first in MVC?

      Authentication filters are new addition from MVC 5. These filters kick in first in the request life cycle and perform the authentication logic. Authorization filters are executed after the Authentication filters successfully executed and authorizes users roles to ensure current user has access to request resource.

      Peter Agyekum Difference Between ViewResult() and ActionResult()

      ActionResult is an abstract class that can have several subtypes. ActionResult Subtypes ViewResult - Renders a specifed view to the response stream PartialViewResult - Renders a specifed partial view to the response stream EmptyResult - An empty response is returned RedirectResult - Performs an HTTP redirection to a specifed URL RedirectToRouteResult - Performs an HTTP redirection to a URL that is determined by the routing engine, based on given route data JsonResult - Serializes a given ViewData object to JSON format JavaScriptResult - Returns a piece of JavaScript code that can be executed on the client ContentResult - Writes content to the response stream without requiring a view FileContentResult - Returns a file to the client FileStreamResult - Returns a file to the client, which is provided by a Stream FilePathResult - Returns a file to the client