Storing Media files in document libraries – 304 issues

I was today attempting to serve a SWF file out of a document library ​which was enabled for anonymous acces, but unfortunately, the document never seemed to get served. After some investigation with Fiddler I found that Sharepoint was serving an HTTP status of 304 (Not Modified) rather than sending the document.

Sharepoint’s Blob caching is quite complex and convolute, I first tried flushing the Blob cache – pump this snippet in to Notepad an fire it up in Powershell

$webApp = Get-SPWebApplication "http://localhost"
Write-Host "Flushed the BLOB cache for:" $webApp

Unfortuantely this didn’t stop the 304 being served instead of the swiff. You can also configure the blob caching for a web application. If you edit the web.config for your web app you’ll find a line that refers to the BlobCache. Change this to enable the types you wish to serve, and enable the setting. Your web application will restart, and your content should be served!

<BlobCache location="C:\BlobCache\14" path="\.(gif|jpg|jpeg|jpe|jfif|bmp|dib|tif|tiff|ico|png|wdp|hdp|css|js|swf|asf|avi|flv|m4v|mov|mp3|mp4|mpeg|mpg|rm|rmvb|wma|wmv)$" maxSize="10" enabled="true" />

Leave a Reply