views:

32

answers:

1

Hi. I have a problem with simple silverlight app, this app has a couple of buttons, each button sets mediaelement source to a short mp3 file and plays it, my problem is that when i press the same button second time it re-downloads mp3 file again but i think it shouldn't, instead it should use a copy of browser cached mp3 file that was downloaded when a button was pressed for the first time. I'm using sl4 and links in mediaelement are just simple uri's, i need to make it working in this way that when some mp3 was downloaded it will be cached on the client browser and further click on button will use a cached version of file instead of downloading it again and wasting my bandwidth. Any ideas ?

UPDATE: Problem is that it is a normal file server hosting files like sl app, entry html, no asp.net usage possibility, at tops it can use php, but my goal is to use a normal file server as a sl app hostler and nothing more.

A: 

The most likely explaination is that the MP3 file are not being sent with the appropriate HTTP cache headers. My preference for static content files:-

Expires: <HTTP-Date format for now + 24 Hours>
Cache-Control: max-age=86400
Last-Modified: <HTTP-Date format for mp3 last modified date>

most servers allow this to be configured easily at a folder or file level.

AnthonyWJones