Posts

Showing posts from June, 2015

MVC vs Code Behind

Image
MVC vs Code Behind So when ASP.NET Webform was so successful, why Microsoft thought of creating ASP.NET MVC.The main problem with ASP.NET Webform is performance, performance and performance. In web application there are two aspects which define performance:- Response time: - How fast the server responds to request?. Bandwidth consumption: - How much data is sent ?. Response time issues Let us try to understand why response time is slower when it comes to ASP.NET Webforms. We did a small load testing experiment of Webform vs Asp.Net MVC and we found Asp.Net MVC to be twice faster. Read more on how this test was done from here Let us try to understand why ASP.NET MVC was better in performance in the above load test.Consider the below simple UI code and Code behind for that UI. Assume the ASPX code has the below simple text box. Hide   Copy Code < asp:TextBox ID =" TextBox1" runat =" server" > In the code behind you have wri...

MVC Custom Authorization

MVC - Custom Authorization ASP.NET MVC supports various types of Authorization /Authentication that are built in. But sometimes we would like to customize it for project requirements. Before going to the authorization process in depth let's have a look at Authentication and Authorization. Actually there is a bit of a misconception about them. The following  are the differences in short: Authentication : It is a process of verification that verifies “Who you are” (it confirms that you are a valid (or invalid) user). Authorization : It is a process of verification that verifies “What to do” (It confirms you are permissible to do (or not to do) that). In the MVC framework there are filters that execute in sequence. The sequence is: Authorization Filters Action Filters Result Filters Exception Filters It's clear that Authorization filters are taking care of authorizing the current user. How Authorize Attribute Works If you are using the ASP.NET membersh...

OWIN (The Open Web Interface)

Image
In asp.net WebApi v2, the OWIN pipeline becomes the default. It is eventually going to be the standard pipeline under any asp.net project. Without OWIN, the asp.net bits are coupled to the way IIS communicates with the application. OWIN abstracts web servers and framework components. That means that your application code will now be aware of the OWIN interface, but not of the webserver that is serving the request.  You can plug any middlewares (and as many as you want) between the webserver and your application. This allows for more modular solutions. You can develop redistributable middlewares that can impact the request/response coming to/from your application, but keep these modules separated from the application code. Diagram Representation Why OWIN !!! Think about a country where the only vehicle available for movement is a truck. Nothing else. If you want to buy a vehicle, you would buy truck. Well, that used to serve good but people started ...