Sponsored Links
ASP.NET 2.0 Tutorials
- Advanced Site Functionality - ASP.NET 2.0
- ASP.NET : Dynamic Image control
- ASP.NET 2.0 Creating Web Wizards
- Displaying Master-Detail Data on Separate Pages in ASP.NET 2.0
- ASP.NET Displaying Master-Detail Data on the Same Page
- ASP.NET DataBound Controls - Details View
- ASP.NET : Using a Grid to Display Detail Information
- ASP.NET 2.0 : Adding Sorting and Paging in GridView
- ASP.NET 2.0 Tutorials : GridView Filtering
- ASP.NET GridView Control
- ASP.NET 2.0 Training : Data Bound Controls
- ASP.NET 2.0 Free Tutorials : SqlDataSource Control
- ASP.NET 2.0 Training : Data Source Object Model
- ASP.NET 2.0 Free Training : Setting Application-Level Caching
- ASP.NET 2.0 Tutorials : Configuring Page-Level Caching
- ASP.NET 2.0 Free Tutorials : Managing Membership and Roles
- ASP.NET 2.0 Free Tutorials : State Management And Caching in ASp.net 2.0
- Forms Authentication in ASP.NET 2.0
- ASP.NET 2.0 Training : ASP.NET Security
- ASP.NET 2.0 Training : Customizing the Session State Mechanism
Tutorials
ASP.NET 2.0ASP.NET 2.0 Tutorials : Configuring Page-Level Caching
ASP.NET 2.0 Tutorials : Configuring Page-Level Caching
In this tutorial you will learn how to configure Page-Level Caching. Page directive and Duration attribute.
Configuring Page-Level Caching
1. In Visual Web Developer, switch to Design view.
2. Drag a Label control to your page, leaving the default name of Label1.
3. Switch to Design view.
4. Double-click the surface.
5. A stubbed out method will be created for you named Page_Load.
6. Add the following highlighted code to the method:
..................void Page_Load(Object sender, System.EventArgs e)
..................{
............................Label1.Text = System.DateTime.Now.ToString();
..................}
7. Press CTRL+F5 to run the page.

8. Close the browser.
Close the browser.
9. Switch to Source view and add the following page directive beneath the @ Page directive:
< % @ OutputCache Duration="15" VaryByParam="none" % >
10. You are setting the page to be cached. The Duration attribute specifies that the page will remain in the cache for 15 seconds.
11. Press CTRL+F5 to run the page again.

12. Refresh the page several times.
13. Since the duration has been set to 15 seconds, the page is only refreshed after the lapse of that time.
Comments
Dayal said:
| Very good! |
Sponsored Links
