Answer:
Response.Cache.SetNoServerCaching();
This statement prevents the server-side caching.
example:
Write this directive below the Page Directive
<%@ OutputCache Duration="40" VaryByParam="None" %>
In the code behind write this code
protected void Page_Load(object sender, EventArgs e)
{
//Important
Response.Cache.SetNoServerCaching();
Response.Write(DateTime.Now.ToLongTimeString());
}
//It wil prevent Caching even when we have mentioned Caching parameters
// in the OutputCache Directive
Asked In: Many Interviews |
Alert Moderator