Forum Moderators: open
Does anybody know how i force a page not to cache any files, or at least swf's?
I have made a CMS in ASP, of which it is controlling what is viewed in the swf. The problem is that when you add content the swf does not update unless you clear the temporary internet files and press refresh.
Surely there is a way round this
Thanks
You will also need to set the mime header to application/x-shockwave-flash
Then add the following line to the top of your code...
Response.Cache.SetCacheability(HttpCacheability.NoCache)
However, i'd advise you not to disable caching completely, as you're going to degrade performance. You can still cache the file but update the cache whenever the data you are depending on changes. That's by far the better option.
Once you've done that, update your HTML to point to the wrapper for the SWF file rather than the SWF file itself.
Unless you use a COM component, you can't do binary writes in classic ASP as far as I know.
private void Page_Load(object sender, System.EventArgs e)
{
//Disable cacheingResponse.Cache.SetCacheability(HttpCacheability.NoCache);
//Set the appropriate ContentType.
Response.ContentType = "application/x-shockwave-flash";
//Get the physical path to your flash file.
string FilePath = MapPath("yourflashfile.swf");
//Write the file directly to the HTTP content output stream.
Response.WriteFile(FilePath);
Response.End();
}
I have done the cms in old asp not .NET, will what mr Mister described still work for ASP?
I have tried a few things other than this, one with HTML where i used a meta tag to not cache any files like so
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
but this did not work. I have also tried using the response object on the page that is pulling in the SWF, like so.
If anyone has any other ideas please let me know. Also is there a way that i could disable caching from the SWF?
I dunno....
Thanks
<% Response.CacheControl = "no-cache" %>
<% Response.AddHeader "Pragma", "no-cache" %>
<% Response.Expires = -1 %>
but again this did not work.
I have tried a few things other than this, one with HTML where i used a meta tag to not cache any files[ ...] but this did not work.
Of course it won't work, it's not the caching of the HTML that is the proplem. It's the SWF that is being cached that's causing a problem!
It doesn't matter that your CMS is written in ASP. Your SWF wrapper can be written ASP.Net and your CMS can remain in ASP. As I said before, ASP can't do Binary Writes without using a COM object.
in the actionscript file that call the results from the database simply set an identifier to the padge that is being called.
"http://www.example.com/content.asp?n="+new Date().getTime()
that sorted the problem for me
Cheers
[edited by: Xoc at 12:28 am (utc) on Oct. 27, 2005]
[edit reason] changed to use example.com [/edit]