Site sponsored by: Idera The gold standard of SQL Server performance monitoring & diagnostics.
SQL Server Performance

  • Home
  • Articles
  • Forums
  • Tips
  • Quiz
  • FAQ's
  • Blogs
  • Software
  • Books
  • About Us
RSS Feeds
Sign in | Join


Article Topics

All Articles
Performance Tuning
Audit
Business Intelligence
Clustering
Reporting Services
Developer
General DBA
ASP.NET / ADO.NET

Write for Us

Share your SQL Server knowledge with others and raise your profile in the community More...
Latest Articles

Recover Data Using Database Snapshots
Analyze and Fix Index Fragmentation in SQL Server 2008
Powerful Geographical Visualisations made easy with SQL 2008 Spatial (Part 2) ...
Backup User Databases Using a Maintenance Plan

More     
 
Latest FAQ's

How to alter a User Defined Data Type?
How to unzip a File in SSIS?
How to view previous query plans?
ALTER TABLE SWITCH statement failed because the object '%.*ls' is not ...

More     
   
Latest Software Reviews

Spotlight on ApexSQL Doc 2008
ApexSQL Enforce
Embarcadero Change Manager
SQL Server DBA Dashboard

More     

articles >> asp.net / ado.net >> Caching in ASP.NET (Part I) ...

Caching in ASP.NET (Part I)

By : Joydip Kanjilal
Feb 18, 2007

Page 3 / 3

Page Fragment Caching

Also known as Partial Page Caching, this is a feature that allows specific portions of the web page to be cached rather than caching the entire web page and is useful in situations where a particular web page can contain both static and dynamic content. MSDN says, “Often, caching an entire page is not feasible, because certain parts of the page are customized for the user. However, there may be other parts of the page that are common to the entire application. These are perfect candidates for caching, using fragment caching and user controls“. The term “fragment” implies one or more user controls in the web page. Note that each of these user controls can have different cache durations. The following statement depicts how this can be accomplished.

<%@ OutputCache Duration="10"
VaryByControl="PatientID” VaryByParam="*"%>


New Page Caching Features in ASP.NET 2.0

With ASP.NET 2.0, you do no longer need to split your pages into multiple .ascx user control files for implementing Page Fragment Caching or Partial Page Caching. You are free to do the same using Output Cache Substitution – a concept that provides you the facility to cache the output of a web page with some dynamic portions inside in page. Note that this is in sharp contrast to ASP.NET 1.x when we needed to implement the same as, in the partial page caching; “the overall page is dynamic, with cached regions in the middle”.

The following code snippet illustrates how we can implement output cache substitution using the <asp:substitution> control.

<asp:Substitution ID="mySubstitutiionBlock" runat="server" MethodName="myMethod" />

Implement the method myMethod in such a way that it contains some code that would display static data. Now, the entire page would be cached except the contents of the <asp:substitution> control. Note that you can also achieve this programmatically using the Response.WriteSubstitution method.

Conclusion

Caching is a great tool that can be used to boost the performance web applications. This article has discussed the ways of storing data in the cache using ASP.NET with code examples wherever applicable. The next part in this series discusses storing data in the cache, i.e., Data Caching in ASP.NET.

<< Prev Page         








Home | Peformance Articles | Audit Articles | Business Intelligence Articles | Clustering Articles | Developer Articles | Reporting Services Articles | DBA Articles | ASP.NET / ADO.NET Articles | DBA FAQ's | Developer Peformance FAQ's | DBA Peformance FAQ's | Developer FAQ's | Clustering FAQ's | Error Messages | Audit Tool Reviews | Backup Tool Reviews | Coding Tool Reviews | Compare Tool Reviews | Documentation Tool Reviews | Design Tool Reviews | Monitoring Tool Reviews | Log Tool Reviews | Reporting Tool Reviews | Clustering Tool Reviews | Security Tool Reviews | Change Management Tool Reviews | Remote Access Tool Reviews | Book Reviews | Security Tool Reviews | QDPMA Performance Tuning | ADO.NET / ASP.NET | Administration | Analysis/OLAP Services | Application Development | Configuration | Components | ETL | Hardware | High Availability | Hints | Index | Misc | Operating Systems | Performance Tuning | Replication | T-SQL | Views


              © 1999-2008 by T10 Media. All rights reserved