Skip to main content

Posts

Showing posts from November, 2016

Asp .net MVC 5 Features-Attribute based routing

Attribute based routing in MVC 5 we can   define the route in the same place where action method is defined Here we specified the route for the controller GetElectronicItems [Route( "Products/Electronics/{id}" )]      public ActionResult GetElectronicItems( string id)      {          ViewBag.Id = id;           return View();      } To enable attribute based routing in RouteConfig.cs we need to add   the following   in the RouteConfig file. public static void RegisterRoutes(RouteCollection routes)        {            routes.MapMvcAttributeRoutes();        } Optional Parameter We can also specify if there is any optional parameter in the URL pattern defined by t...

Asp. net MVC 6 Features

Asp. net MVC 6 Features ·            Cloud optimized versions of MVC, Web API, Web Pages, SignalR, and EF ·          MVC, Web API and Web Pages merged into one framework (MVC6) ·          No dependency on System.Web (HttpContext object graph drops from ~30k/req to ~2k/req) ·          New project extension project.json to list all dependencies and a Startup class that replaces global.asax ·          Cloud ready by design. Session state and caching adjust behavior depending on hosting environment. ·          Host agnostic ·          True Side-by-side deployment. Just upload dependencies to the bin directory without affecting other apps on same server. ·   ...

Asp .net MVC Questions and Answers-3

Asp .net MVC Questions and Answers Asp .net MVC Questions and Answers 21) Explain how you can send the result back in JSON format in MVC? In order to send the result back in JSON format in MVC, you can use “JSONRESULT” class. 22) Explain what is the difference between View and Partial View? View Partial View It contains the layout page It does not contain the layout page Before any view is rendered, viewstart page is rendered Partial view does not verify for a viewstart.cshtml. We cannot put common code for a partial view within the viewStart.cshtml.page View might have markup tags like body, html, head, title, meta etc. Partial view is designed specially to render within the view and just because of that it does not consist any mark up View is not lightweight as compare to Partial View We can pass a regular view to the RenderPartial method       ...

Asp .net MVC Questions and Answers-2

Asp Dot net MVC Questions and Answers Asp .net MVC Questions and Answers 11) Explain the role of “ActionFilters” in MVC? In MVC “ ActionFilters” help you to execute logic while MVC action is executed or its executing. 12) Explain what are the steps for the execution of an MVC project? The steps for the execution of an MVC project includes Receive first request for the application Performs routing Creates MVC request handler Create Controller Execute Controller Invoke action Execute Result 13) Explain what is routing? What are the three segments for routing is important? Routing helps you to decide a URL structure and map the URL with the Controller. The three segments that are important for routing is ControllerName ActionMethodName Parameter 14) Explain how routing is done in MVC pattern? There is a group of routes called the RouteCollection, which consists of registered routes in the application.  The RegisterRoutes method...

Asp .net MVC Questions and Answers-1

Asp .net MVC Questions and Answers Asp .net MVC Questions and Answers 1) 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. 2) 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 3) Explain in which assembly is the MVC framework is defined? ...

Routing in aso.net mvc

hat are routing in MVC? Routing helps you to define user friendly URL structure and map those URL structure to the controller. For instance let's say we want that when any user types "http://localhost/View/ViewCustomer/" , it goes to the "Customer" Controller and invokes "DisplayCustomer" action.This is defined by adding an entry in to the "routes" collection using the "maproute" function. Below is the under lined code which shows how the URL structure and mapping with controller and action is defined. Where is the route mapping code written? The route mapping code is written in "RouteConfig.cs" file and registered using "global.asax" application start event. 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. Explain attribute based routing in MVC? This is a feature i...

Dot Net Basic Interview Questions

                                           CLR and C# 1. Types of Authentication IIS. A. Authentication is the process which helps web server(IIS) to check and confirm the identity of the client who request to access the website. Types of Authentication:  a. Http Authentication: Basic Authentication, Digest Authentication b. Integrated Windows Authentication: NTLM(Network Lan Manager), Kerberos c. Client Certificates Access d. Anonymous and UnAuthenticated Access e. Logon-Redirection based: Form Authentication(IIS 7.0) 2. Types of Authentication and Authorization in ASP.Net. A. Types of Authentication: Windows Authentication, Forms Authentication Types of Authorization:- File Authorization and URL Authorization 3. ASP.Net Life cycle.  A. In ASP.Net, the request starts with the client and processed through IIS.  In IIS, there are 2 utilities- INetI...