Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


using getURL it loads form cache i want it to download from the site

Posted on 2003-03-06
Medium Priority
Last Modified: 2008-02-01
P L E A S E   H E L P

using getURL it loads form cache i want it to download from the site.because the file im using is asp and the info is diffrent when it loads from the site in <href>
in my asp code it does reload it from the site.

Question by:avirama2

Expert Comment

ID: 8080639
please refer to

for the answer from james ...
that's what u should add to the end of the url

getURL("...swf"++ New Date().getTime(), .... )

solution from whodini2k

whodini2k if u see this, come back and get ur pts :)

ha ha ha


Accepted Solution

James Peek earned 240 total points
ID: 8084419
Hah thanks for that Henry.

Just for correctness sake:

   getURL("myFile.swf?nocache=" + new Date().getTime());


Expert Comment

ID: 8085263
in your ASP page, add the line:

Response.Expires = n

where 'n' is the the number of minutes before the page will expire.

0 - will expire the page immediatley

-1442 - will expire for all time zones around the world.

good luck

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.


Expert Comment

ID: 8086207
both ways they all work :)

cheers guys

Expert Comment

ID: 8087159

I only have this problem while developing flash apps, and it is because Flash uses the standard IE API to download files.

Turn off caching in Internet explorer by choosing:
Tools>Internet Options>Settings>Every visit to Page

both other solutions work, but are quite unelegant, and your site's visitors will get the right version, because the usual time interval for checking new versions is right when not developing.

Whodini's solution would be nice if you would use the SWF's file modification date instead of the current time, then you'll be sure to always download the right version, but still allows you to cache.

ocgstyles' solution works for asp pages, but not for non-dynamic SWF's.

Luck, Wiebe

Expert Comment

ID: 8087286
so we should have a note there for everyone and say ...

"Please do that to you IE
Tools>Internet Options>Settings>Every visit to Page"

... blah blah blah ... that's rather elegant... hmmmm

if the question is how to prevent getURL it from getting cached files, whodini2k solution is the best.


Expert Comment

ID: 8087607

It's not blah blah, as End Users don't experience this problem.

Standard it is set on 'automatically', wich will work perfectly if you don't generate a new SWF file every minute.

The only one with the problem is the developer.

the whodini2k solution is very unelegant, as it forces a download of the file every time it is requested, even if users click 'back' to it.

The SWF files are not just cached on the client, but also on other proxy servers.

Practically, this means it will at least double or triple your server traffic (at least the SWF files), generates unnecessary load over the clients connection, wich also means a slow down.

Doesn't really matter for small files (<100k), or small sites (<100 visitors a day), but don't use it in professional sites.


Expert Comment

ID: 8087724
yes Uritsukidoji, i agree with u concern over the bandwidth etc, i know what u are talking about, but the question asked here is ...

using getURL .... to get it from the site and not from cache. that's why i think whodini2k solution is good for this situation and what avirama2 asked for.

Tools>Internet Options>Settings>Every visit to Page
doesn't guarantee the most update info from the site anyway, if the getURL request an asp,jsp whatever, the file date time does change and the static content is pull form cache instead... again .. that's why i think whodini2k works best for this particular situation.

well, as u have mentioned cache happens not only to the browser and the proxy as well, so again whodini2k works.

and ... conculsion, whodini2k's suggestion works without any extra settings ... so i think it is elegant and best fot THIS question asked.

of course i will have to agree with u it the file are a swf which is 10MB in size with fancy animations & sounds etc ... but who will add the extra script bit to the getURL as proposed to prevent such a big file from caching?

u have your point and i do agree with what u said, but elegant or not, it is circumstantial :)

cheers Uritsukidoji

Expert Comment

ID: 8087858
Henry, actually, reviewing the question again, I think ocgstyles' solution is the most elegant, since avirama is not requesting the newest version of flash a flashfile, but the newest version of a ASP page.

All three solutions do exactly what avirama wants, but the one to use depends on the context of the problem.

If it's just design-time developer problems, I would go with the IE settings, any other, go for the ASP page caching.

But I also agree with you, the suppose avirama couldn't edit the asp page or change IE settings, you solution will be ok.

Expert Comment

ID: 8088271

firstly, it is not my solution.

i normally do it in the stupid way using random variable if i really have to that, but no since i have a different way in requesting data from script files, ...

and the using date object + an extra parameter will defintely prevent the browser from caching... agree?

it is a common practice to add extra parameters to the end of the url to prevent the broswer from cahcing and the most reliable way ... i can assure u this. u want to know why?... maybe u already know since u know everything about proxy and web server and network, so ...

ok fine, if u like to tell the user to change the settings on the browser, list out all the browser version and how to do, for NN, AOL, Opera , IE all version ... etc ...

in my opinion, that is not elegant nor user friendly.

in Q_20538312.html you wrote
"The solutions here are unnecessary non-solutions"

the question was solved by stephenburke himself using the same method and whodini2k suggested a better way for that. i did not refer u to that thread, you didn't ask this question. i was telling avirama2 to have a look at that thread.

u have a point about the bandwidth consideration etc, but requesting an new asp file will probably be less than 5k. why using whodini2k's method is no good for ASP page?

ocgstyles method does work too, but that depends totally on the clock both on the client side and server side ...

i have no problem with any discussion, as long as it is a healthy one. but not going to other threads and advocating an argument ...
LVL 22

Expert Comment

ID: 8088490

there is no way I would ever tell a user to change there settings just so my application would work for them...  that is like a bank teller asking a person to change there US dollars to marbles to make a deposit.  I would flip the bank teller the bird and take my business else where... which is what all of your users will do as well.

If your server can't support the bandwidth, then get a bigger one!

And I am not really sure what you mean by "The solutions here are unnecessary non-solutions"...  

Everything I have seen so far works fine if implemented properly, and are all solutions to this problem...  and changing one line of code in your flash application and one in your ASP is quite elegant.  

I think it is rude to call an experts solution unelegant, and then offer up a GUI mistake for your own solution.

If you have a solution that is lighter on a server, easier to implement, and does not make the user aware of a possible problem, the please enlighten us...  we should be so lucky...



Expert Comment

ID: 8101455
you didn't read my reaction well, I only had this problem while developing a Flash movie, because IE and other browsers don't check every time you refresh for a new file version.

My answer was based on Avirama being unable to see the new file version after she saved it.

I call modifing the entire solution just for developing comfort extremely unelegant, but probably wasn't the case here, because as henryww noted, it's about ASP pages and not SWF movies.

I'm sorry if I offended you all, I didn't mean to, just trying to get the right solution.

Technically, what you're trying to achieve is the content of the file to expire immediately, as every request produces a new result, wich is exactly what the Response.Expires = 0 does. (I thought it was about static SWF movies first being cached even after updates, sorry henry)

Generating a unique URL for every request would mean a user would have a temporary internet file for every request and reload, while response.expires will event prevent the file from being saved.

Choosing one or another method would make little difference, It's just from a technical perfectionist perspective I don't like the 'date-parametered-urls' idea.

Cheers Rascalpants & Henryww + keep up the nice work.. :)


Expert Comment

ID: 8102034
that's fine Uritsukidoji. it is ok to bring up the subject and discuss professionally and technically. i see what u mean.

again the solution will vary very much depending on servers, browsers, network etc ... not one solution is best for all, but this one seems to do what the asker wants ... so it is fine.

i understand what ur concerns are and why ... and in reality we wasted much of the bandwidth of doing lots of silly things like popup ads, banners, some useless intros .. etc etc ... not just an 1k asp page.

technically, the  Response.Expires = 0  should work, but it varies on server esp earlier versions of IIS and chiliAsp ... etc, it makes it quite unreliable.

getting the file cached everything may create duplicated files again, the cache will expired and newer contents will be cached within the set limit. so ...

well well ... it is finally done and over.

cheers experts :)

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.
Suggested Courses

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question