Home | Submit an interview question | Filter by category | Filter by job function | Filter by company
 
Member Information
User Id
Password
 
Forgot Password
Technology Category
.NET (1202)
Languages (103)
Database (146)
Operating System (48)
Reporting (5)
Third-Party Tools (2)
Testing (91)
OOP (75)
Web Development (40)
Design Patterns (89)
General (9)
Networking (88)
Hardware (63)
Brain Exercise (2)
Others (37)
 Our Network
.NET Heaven
C# Corner
Interview Corner
Longhorn Corner
Mindcracker
VB.NET Heaven
Home » .NET » .NET
What is Fragment Caching in ASP.NET?
Posted by Sapna Malik Sep 28, 2009
Viewed : 766 times
Major Category : .NET
Minor Category : ASP.NET
Total Replies : 2
Become a Sponsor
 EDITORIAL ANSWER  
No Reply Yet
 ANSWERS BY USERS  
kalit sikka
Oct 26, 2009

ASP.NET provides a mechanism for caching portions of pages, called page fragment caching. To cache a portion of a page, you must first encapsulate the portion of the page you want to cache into a user control. In the user control source file, add an OutputCache directive specifying the Duration and VaryByParam attributes. When that user control is loaded into a page at runtime, it is cached, and all subsequent pages that reference that same user control will retrieve it from the cache.

<!— UserControl.ascx —>

<%@ OutputCache Duration='60'
VaryByParam='none' %>
<%@ Control Language="'C#'" %>

<script runat="server">
protected void Page_Load(Object src, EventArgs e)
{
_date.Text = "User control generated at " +
DateTime.Now.ToString();
}
</script>
<asp:Label id='_date' runat="'server'" />

Here I have user caching on user control, so when ever we used in a page , only partial page will be cached.

http://kalitinterviewquestions.blogspot.com/

Sapna Malik
Sep 28, 2009

Fragment Caching in asp.net

  • Fragment caching refers to the caching of individual user controls within a Web Form. 
  • Each user control can have independent cache durations and implementations of how the caching behavior is to be applied.
  • Fragment caching is useful when you need to cache only a subset of a page. 
  • Navigation bars, header, and footers are good candidates for fragment caching. 
  
1

 

 Hosted by MaximumASP  |  Found a broken link?  |  Contact Us  |  Terms & conditions  |  Privacy Policy  |  Advertise with us
Current Version: 2.2009.3.2
 © 1999 - 2009  Mindcracker LLC. All Rights Reserved