0

I try to disable the html url browser cache using programmatically. I am developing as a site using asp.net, I need to disable the html url browser for the security reason. I tried many ways to disable the cache but none seems to work. Any ideas?

<iframe id="iframe" src="http://www.phy.mtu.edu/basiccomputing/sample.html" runat ="server" width="200" height="300"></iframe> 
1

3 Answers 3

1

As far as it's a html file you want to work with, a easy solution is to append a random number and the end of your url like this

<iframe id="iframe" src="http://www.phy.mtu.edu/basiccomputing/sample.html?12345" runat ="server" width="200" height="300"></iframe> 

I don't know wich view engine you are using, so i cant provide a sample you simple copy and paste.

You have to replace ?12345with a random number like new Random().Next().ToString()

If you call a asp.net page you can control it with

Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache); Response.Cache.SetNoStore(); 

more informations about that:

ASP.NET Cache Examples

hope this helps

Sign up to request clarification or add additional context in comments.

Comments

0

You could attach a random parameter to the URL so the browser thinks it's a different page every time.

http://www.phy.mtu.edu/basiccomputing/sample.html?rand=[INSERT RANDOM HERE] 

Comments

0

try

HttpContext.Current.Response.Cache.SetExpires(DateTime.UtcNow.AddDays(-1)). This site has something that can be quite helpful.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.