Click here to Skip to main content
15,884,472 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How Sensitive data is accessible from cache.
I write below code on Page Load
protected void Page_Load(object sender, EventArgs e)
       {
           Response.ExpiresAbsolute = Convert.ToDateTime("1/1/1980");
           Response.AddHeader("cache-control", "no-store, must-revalidate, private");
           Response.AddHeader("Pragma", "no-cache");
           Response.Cache.SetCacheability(HttpCacheability.NoCache);
           Label1.Text = "sddddddddddddddddddddddddd";
       }

But it does not work when i click on work offline in Firfox and click on the Url from history option.
What is the best practice to avoid Sensitive data is accessible from cache in asp.net.
Also when i click on back button then also previos page content show which is more dangerous as sensitive data leakage issue what can be done to handle such situation.
Posted
Updated 6-Feb-14 18:01pm
v2

1 solution

 
Share this answer
 
Comments
vishal_h 7-Feb-14 2:06am    
Thanks for the reply but above solution not work on Firfox as its showing the content after click on work offline and click on back button.Solution works on IE properly.
vishal_h 7-Feb-14 5:16am    
I write below code but still not able to work in firefox 20.0.1

Response.AppendHeader("Cache-Control", "no-cache") '
Response.AppendHeader("Cache-Control", "private") '
Response.AppendHeader("Cache-Control", "no-store") '
Response.AppendHeader("Cache-Control", "must-revalidate") '
Response.AppendHeader("Cache-Control", "max-stale=0") '
Response.AppendHeader("Cache-Control", "post-check=0") '
Response.AppendHeader("Cache-Control", "pre-check=0") '
Response.AppendHeader("Pragma", "no-cache") '
Response.AppendHeader("Vary", "*")
Response.AppendHeader("Expires", "Mon, 26 Jul 1997 05:00:00 GMT")

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