Click here to Skip to main content
15,881,204 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I have frame
i am loading xyz pdf on page_onload method

i have browse button which selects pdf from client machine and replaces it with xyz pdf.
after replacing on server i am updating my frame with newly updated pdf.


Here my pdf is getting replaced on server.
but it is not getting refreshed in my frame. even after setting its pdf path to new pdf.
my new pdf and old pdf has same filename.

After researching what i found is this pdf is their in my browser cache and my code is not clearing that.
I tried all of following methods
but none of them are working.
i checked my pdf on server it is new one.


C#
myframe.Dispose();

Response.Cache.SetCacheability(HttpCacheability.NoCache);

myframe.Attributes.Add("src", "");


XML
<meta http-Equiv="Cache-Control" Content="no-cache">
<meta http-Equiv="Pragma" Content="no-cache">
<meta http-Equiv="Expires" Content="0">



when i went to my browser cache it is not replacing my older pdf with new one.
i dont know why it is reading from my browser cache, even after giving servers path, and why it is not replacing in browser cache.

please help me in clearing this cache.

Regards,
SUNIL MALI.
Posted

Check for bellow code

C#
public static void DisablePageCaching()
{
    //Used for disabling page caching
    HttpContext.Current.Response.Cache.SetExpires(DateTime.UtcNow.AddDays(-1));
    HttpContext.Current.Response.Cache.SetValidUntilExpires(false);
    HttpContext.Current.Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches);
    HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
    HttpContext.Current.Response.Cache.SetNoStore();
}
 
Share this answer
 
Check for bellow code

C#
public static void DisablePageCaching()
{
    //Used for disabling page caching
    HttpContext.Current.Response.Cache.SetExpires(DateTime.UtcNow.AddDays(-1));
    HttpContext.Current.Response.Cache.SetValidUntilExpires(false);
    HttpContext.Current.Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches);
    HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
    HttpContext.Current.Response.Cache.SetNoStore();
}
 
Share this answer
 
Comments
sunil mali 17-Jul-13 8:08am    
No sir,
Its not working in my case.
My Old Pdf in cache is not getting cleared.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900