Whilst writing the sound support for FormShield v2, I came across quite an interesting issue, well it was interesting once I'd found the answer, but up until then I wasn't in the best of moods.
Basically, FormShield uses the BinaryWrite() method to write an audio file to the requesting browser to provide sound support. The issue was that this worked fine in IE, Safari and Opera, but for some reason Firefox didn't seem to like it.
The strange thing about it was that it would play the first x number of characters, but then stop. On a Mac, it would only play the first character before giving up.
Thinking that it must be something to do with how I was writing the file out, or perhaps the file size, or even my code that builds the sound file, I started to pull the code apart.
A few hours later, I was no further forward.
I came to the conclusion that it couldn't be my code, after all, writing images out this way seemed to work fine in every browser.
So, I started to look around the problem. I then stumbled across an old post related to writing out PDF files on the fly using BinaryWrite and whilst the issue didn't see to be the same, or affect the same browser (they were talking about IE), one word was mentioned that rang a bell - "Compression".
I suddenly remembered that HTTP compression was enabled in IIS on this particular server - Quickly turning it off and running an 'iisreset' and testing resulted in a perfect playback.
Thankfully all of the code I changed was only a CTRL-Z away from being put back to how it was originally and 10 minutes later I retested it and it worked fine.
So, why does HTTP compression in IIS only break Firefox? No idea - After spending seven hours on the problem I really couldn't care.