Skip to main content

Posts

Showing posts with the label ASP.NET MVC

ASP.NET MVC Learning : Routing Advanced

To specify a route you need to create the instance of the class Route by specifying the  * URL Pattern Name  * URL Pattern   * Handler URL Name   Can be of any name and empty string '' is allowed URL Pattern  Default (System generating) URL pattern is {controller}/{action}/{id}, however you can use the following patterns as you want employee/{action}/{entry} --> employee/update/111 {reportname}/{year}/{month} --> employeeattendance/2018/06 {classcode}-{studentid}/{action} --> XII/212/show Handler There are three types of handlers used, MvcHandler, This handler is initiating the ASP.NET pipeline for the ASP.NET MVC application, as this is receiving the controller instance from MVC controller factory, which takes care of further processing  MvcRouteHandler  MvcRouteHandler is implementing the IRouteHandler interface and pass the request context to it. MvcHttpHandler Used to handle the mapping directly without going through the routing mod

ASP.NET MVC Learning 1 : Introduction

ASP.NET MVC is the open source web application building framework from Microsoft which implements (M-V-C) pattern,   M - Model  --> Contains Data and information on how to handle data (Business Logic) V - View --> Representation of data to the user (User Interface, Front End) C - Controller --> Sits between the Model and View, acts as interface between them, basically the controller takes the user request and provide the view with correct model data   This is software developing pattern which implements Seperation of Concerns (SoC), which decouples all the three components to enable it for better parallel programming, Advantages of MVC pattern Easy and Fast Development of code More meaningful URLs which provides the competetive edge over traditional URLs  Change Friendly Maintenance Friendly Test Friendly (Test Driven Development is fully supported) Easy to divide the application and respective teams such as Design Team, Developent Team, Database Team can co

ASP.NET MVC Learning 3 : Global.asax File

The Global.asax file is called as the ASP.NET application file, which contains the events related to Application and Session level The file will be positioned in the root level of the Web Application. Adding this file to the application is not mandatory, if you want to handle the Application events or session events then you can use the file The following are the events available in the file,         protected void Application_Start( object sender, EventArgs e)         {            // Triggered when the application starts, the logs to the event handler, initializing singleton objects may be written here         }         protected void Session_Start( object sender, EventArgs e)         {         }         protected void Application_BeginRequest( object sender, EventArgs e)         {         }         protected void Application_AuthenticateRequest( object sender, EventArgs e)         {         }         protected void A

ASP.NET MVC Learning 2 : Routing Basics

ASP.NET Routing in ASP.NET MVC  is the concept of mapping the incoming request (URL) with the existing resources  For Example :  The incoming request URL for a local application is http://localhost:2233/home/index In the Application say we have configured the routing as "{controller}/{action}/{id}", so Home is the controller here and index is the action here, the id is optional in most cases, if id is not given then it will display the default value In ASP.NET MVC the controllers should have the naming convention, in this case the controller's name should be Home Controller, should end with 'Controller' suffix. The Routing mechanism looks in the HomeController for the Action that we set already, Here Home is Controller and the Action is Index In the Home Controller we will return the View (That is Index) as Action Result Sample Home Controller public class HomeController : Controller { public ActionResult Index ( ) { return V

ASP.NET MVC Interview Questions Part 1

1) What is MVC generally? M - Model  --> Contains Data and information on how to handle data (Business Logic) V - View --> Representation of data to the user (User Interface, Front End) C - Controller --> Sits between the Model and View, acts as interface between them, basically the controller takes the user request and provide the view with correct model data   This is software developing pattern which implements Seperation of Concerns (SoC), which decouples all the three components to enable it for better parallel programming, 2) What are the Advantages of MVC pattern Easy and Fast Development of code More meaningful URLs which provides the competetive edge over traditional URLs  Change Friendly Maintenance Friendly Test Friendly (Test Driven Development is fully supported) Easy to divide the application and respective teams such as Design Team, Developent Team, Database Team can collaboratively work 3) What is the current stable version of ASP.NET M