Link to home
Start Free TrialLog in
Avatar of bedanand
bedanandFlag for Nepal

asked on

Caching for master page

Dear experts,

I m implementing a cms site.  I have used master page with place holders to implement template. User controls are loaded on the master page depending on the data provided on the database.

I m just worried about the performance of the site since everything is loaded at runtime.
How can i implement cahching on master page level to improve performance.

Regards
Bedanand
Avatar of Deathrace
Deathrace
Flag of India image

hei,
you cannot add output cache directive to master page, you need to set it programmatically.
in the Page_Load use some thing like this



protected void Page_Load(object sender, EventArgs e)
{
    Response.Cache.SetExpires(DateTime.Now.AddMonths(1));
    Response.Cache.SetCacheability(HttpCacheability.ServerAndPrivate);
    Response.Cache.SetValidUntilExpires(true);
}

Open in new window

Avatar of bedanand

ASKER

How can i set the cache for the varing querystrings values and varing session values?

ASKER CERTIFIED SOLUTION
Avatar of Deathrace
Deathrace
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial