Optimizing ASP.NET MVC view lookup performance

Earlier today Sam Saffron from the StackExchange team blogged about the performance of view lookups in MVC. Specifically, he compared referencing a view by name (i.e. calling something like @Html.Partial(“_ProductInfo”)) and by path (@Html.Partial(“~/Views/Shared/_ProductInfo.cshtml”)). His results indicate that in scenarios where a page is composed from many views and partial views (for example, when you…


ASP.NET MVC Performance Tips

Database access is usually the largest performance bottleneck of web applications. But once you’ve optimized and cached your database queries as much as possible here are 3 quick tips that might help you squeeze out a few more requests out of your ASP.NET MVC applications and web servers. Depending on which features you are using…


ASP.NET MVC 3 Performance – on par with MVC 2

Now that the final version of MVC 3 has been released I think information about the performance characteristics of this latest installment would be very useful for those weighing the pros and cons of updating their MVC 2 applications. In this post I will talk about what you might expect when moving to MVC 3….


MVC 3 Project Upgrade Tool

We have just released the final version of ASP.NET MVC 3. Read the official MVC 3 release information or download MVC 3. To help you upgrade your MVC 2 projects to MVC 3 we have released an upgrade tool. You can download it here: http://aspnet.codeplex.com/releases/view/59008. (This is an update of the tool that Eilon Lipton previously…


Razor, Nested Layouts and Redefined Sections

In a recent post I introduced a technique for dealing with optional Razor sections and default content. In this post I will expand upon that technique and describe a way of working with sections across nested layout hierarchies. If you are not familiar with sections, layout pages, or my technique then go ahead and read…


Optional Razor Sections with Default Content

Solution quick links: IsSectionDefined method Razor inline templates RenderSection The new ASP.NET page framework built on Razor (which is available in MVC 3) provides a facility for content pages to contribute named fragments of markup to their layout pages which the layout page can then render in an arbitrary location using the RenderSection method. For…


Fixing area view lookups when using multiple view engines

11/17 Update: I’ve fixed a bug in the view engine registration code that prevented this method from working. Please note the addition of the dummyFormats property in the solution below. Oskar from the ASP.NET forums asked a question about the order of view lookups when using Areas in MVC 3. The problem is that now that…


Granular Request Validation in ASP.NET MVC 3

12/10 Update: In MVC 3 RC 2 SkipRequestValidationAttribute got renamed to AllowHtmlAttribute. I have updated the examples below. A little while ago I wrote a blog post describing granular request validation that shipped in MVC 3 Beta. However, since then we have changed the API for this feature and that post is no longer valid….


Granular Request Validation in ASP.NET MVC 3 Beta

11/9 Update: This article only applies to the MVC 3 Beta release. I have a new post about AllowHtmlAttribute that describes the new APIs and behaviors available in MVC 3 RC and later. If you don’t know already, we have just released the ASP.NET MVC 3 Beta and it brings a slew of new features….