views:

433

answers:

2

How can I cache the master page in ASP.NET?

A: 

If you use the @OutputCache directive on the page that uses the master page, then the master page will be cached along with the rest of the page.

cxfx
But he didn't want to cache the rest of the page. Right?
Faruz
A: 

Unlike user controls, you can't OutputCache a Master page by itself--only as part of a Page.

Also, OutputCaching won't help the performance of a toolbar with lots of images anyway.

The kind of things that would help include image sprites, client-side caching, using a CDN, using multiple domains for static files, etc.

In case it's helpful, I cover those strategies in my book: Ultra-Fast ASP.NET.

RickNZ
In which portion of the book you covered that things. Please make reply
Sauron
I cover client-side performance issues in Chapter 2 (pages 13 to 70), including optimizing your HTML structure, optimizing network use with multiple subdomains, image sprites, etc. Then I cover caching in Chapter 3 (pages 71 to 126), including caching at all tiers: client, proxies, server kernel (http.sys), IIS, output caching, fragment caching, etc. There's also a section on Master Pages and User Controls in Chapter 6. The whole book is focused around performance tips; I'm sure other chapters will also be useful.
RickNZ
Definitely your book is very much useful. Thanks for such a book.
Sauron