Who's Online
8 visitors online now
0 guests, 8 bots, 0 members
Support my Sponsor
  • An error has occurred, which probably means the feed is down. Try again later.

Posts Tagged ‘lifecycle’

ASP .NET MVC Life Cycle

Hello Everyone,

In this blog we will discuss life cycle for ASP.NET MVC. Before starting with MVC, it’s a very important to know that how does your request process.

mvclifecycle

In above figure I tried to show how MVC application process. Your browser sends and receive request in form of HTTP Request and HTTP Response respectively. Routing is a process in which it analyzes the request and invokes an Action of the appropriate Controller. Action calls appropriate method of the model.The Model communicates with the data source (e.g. database or API). Once the Model completes its operation it returns data to the Controller which then loads the appropriate View. The View executes presentation logic using the supplied data. In the end, an HTTP response is returned to the browser.This is just a quick view of MVC life-cycle.

Let’s see details view of MVC life cycle.

This is performed by following steps.

  • Receive first request for the application: An MVC application contains only one Route Table. The Route Table maps particular URLs to particular controllers. Check below code of Global.asax: Routes objects are add to  RouteTable object when application  starts first.The Application_Start() method is invokes only once when the very first page is requested.
    public class MvcApplication : System.Web.HttpApplication
    {
    public static void RegisterGlobalFilters(GlobalFilterCollection filters)
    {
    filters.Add(new HandleErrorAttribute());
    }

    public static void RegisterRoutes(RouteCollection routes)
    {
    routes.IgnoreRoute(“{resource}.axd/{*pathInfo}”);
    routes.MapRoute(
    “Default”, // Route name
    “{controller}/{action}/{id}”, // URL with parameters
    new { controller = “Home”, action = “Index”, id = UrlParameter.Optional } // Parameter defaults
    );
    }

    protected void Application_Start()
    {
    AreaRegistration.RegisterAllAreas();
    RegisterGlobalFilters(GlobalFilters.Filters);
    RegisterRoutes(RouteTable.Routes);
    }
    }
  • Perform routing : When we make a request in MVC, UrlRoutingModule reads these request to create a RequestContext object.When requested URL found in RouteTable, the Routing engine forwards the request to the corresponding IRouteHandler for that request. The default one calls the MvcHandler. The routing engine returns a 404 HTTP status code against that request if the URL patterns is not found in the Route Table.
  • Create MVC request handler: MVC handler implements IHttpHandler interface and further process the request by using ProcessRequest method.When ProcessRequest() is called on the MvcHandler object created, a new controller is created, as show in below code.                                             
  • Create and Execute controller: The controller is created from a ControllerFactory. This is an extensibility point since you can create your own ControllerFactory. The default ControllerFactory is named, appropriately enough, DefaultControllerFactory.The RequestContext and the name of the controller are passed to the ControllerFactory. CreateController() method to get a particular controller. Next, a ControllerContext object is constructed from the RequestContext and the controller. Finally, the Execute() method is called on the controller class. The ControllerContext is passed to the Execute() method when the Execute() method is called. For reference check below code.                                                                                        
    virtual void ProcessRequest(HttpContextBase httpContext)
    {
    SecurityUtil.ProcessInApplicationTrust(delegate {
    IController controller;
    IControllerFactory factory;
    this.ProcessRequestInit(httpContext, out controller, out factory);
    try
    {
    controller.Execute(this.RequestContext);
    }
    finally
    {
    factory.ReleaseController(controller);
    }
    });
    }

  • Invoke action:The Execute() method finds a action of the controller to execute. Controller class can be created by us and Execute() method finds one of the methods that we write into the controller class and executes it.
  • Execute result: Action method of controller  receives the user input data, process these data and returns result. The built-in result types can be ViewResult, RedirectToRouteResultRedirectResultContentResult, JsonResult, FileResult, and EmptyResult.

 

For more details Visit HERE

I hope this will help you.Your valuable feedback and comments are important for me.

Microsoft AppFabric 1.1 support will end soon but what about its integration in SharePoint 2013

I recently  found article which says “Microsoft AppFabric 1.1 for Windows Server Ends Support 4/2/2016“. This was a shocking news for me because SharePoint 2013 uses Microsoft AppFabric 1.1, and this means support for SharePoint will also be effected.

 

In case if you don’t know what is AppFabric 1.1, AppFabric provides hosting, management and caching capabilities for Web applications and middle-tier services. This application helps us to build, scale and manage applications, in particular those built using ASP.NET, Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF).

 

Microsoft has recommended all applications using AppFabric 1.1 for Windows Server to migrate off this technology by April 2, 2016. Recommended alternative is Azure Redis cache.

 

Azure Redis Cache is was build on the popular open source Redis Cache. It provies you access to a secure, dedicated Redis cache, managed and fully supported by Microsoft, so you can focus on your application rather than the infrastructure. We recommend all Microsoft AppFabric customers using Cache to move to Microsoft Azure Redis Cache.

 

As per my knowledge SharePoint 2013 leverages Workflow Manager and an internal workflow hosting for legacy workflows.

 

Finally I found a comment by Erica Mohler(Microsoft) which says “SharePoint functionality (including the Distributed Cache feature) will be supported under the Microsoft Support lifecycle for SharePoint 2013” which was a relief moment for me.

 

Another important point to consider that the next version of SharePoint which is suppose to be SharePoint 2016 will integrate with Azure Redis.

 

Hope this will help you.