MP3 - Response write

Hello all,

I am facing problem and have been searching for it for long now…

Here is the problem:

  • I wish to play mp3 file from database BLOB data
  • I have a flash player which is playing mp3 from filing structure. not BLOB.
  • How can I write byte array to browser on the fly?

HEre is the code:


public void ProcessRequest(HttpContext context)
{
          AudioInfo audioInfo = AudioFileInfo("c:/myaudio.mp3");
          context.Response.ContentType = audioInfo.audio_file_content_type;
          context.Response.BinaryWrite(audioInfo.audio_byte_array);
}

The above code is from my .NET handler “audio.ashx” file which is handling AudioMp3Requests.

Or, may be there’s someway to protect my mp3 files in particular directory? Only I can access it. Is it possible?

Thanks in advance.