Last post Nov 16, 2006 11:30 AM by oneill
Oct 27, 2006 07:29 PM|oneill|LINK
I hope someone can help me out with this one. I am working on a web application that plays mp3s. The mp3 player I'm using is PseudoMP3, a free .net mp3 player server control. My problem is that i'm trying to secure the mp3 files by saving them in a folder
outside of my root, but I can't access the files from my application. My site is hosted by an ISP. My syntax for getting the files is:
PseudoMP3Pick.Src = @"d:\websites\sampleDomain\mp3s\Superman.mp3";
But it doesn't play the file. If I do a File.Exists, it says the file exists. My app just can't play it. Do I have to convert it to a different data type?
The root directory is d:\websites\sampleDomain\httpdocs\. I'm using C#. Thanks for the help!
Oct 27, 2006 08:36 PM|mbanavige|LINK
you probably going to want to serve up the mp3 from a custom httphandler
this way you can server it from anywhere on the server and you can add additional security checks
PseudoMP3Pick.Src = @http://mywebsite.com/myApp/myHttpHandler.ashx?Tune=Superman.mp3;
here's an article on file downloading that's probably relevant:
PseudoMP3Pick might be making byte range requests so it can start playing the file before its fully downloaded - i don't know as i've never used it.
here's an article on httphandlers:
Oct 28, 2006 08:35 PM|oneill|LINK
Thanks for your reply. So the httphandler would handle accessing of files outside the rootfolder?
Oct 28, 2006 08:40 PM|mbanavige|LINK
[quote user="oneill"] So the httphandler would handle accessing of files outside the rootfolder?
the httphandler can access files from anywhere you need even if those files arent directly exposed through a url.
only the handler need to be accessible from a url
i use this technique to secure software downloads, pdf downloads, image downloads etc...
Nov 16, 2006 11:30 AM|oneill|LINK
Sorry got busy with other projects, didn't get a chance to look into this too much. So when the httphandler accesses the files, how does it pass the file to an aspx page? for example I have an aspx page that needs access to a file outside the root, instead
of the aspx accessing the file directly, I use the httphandler, right? How then can the httphandler return the file to the aspx page?
Thanks for the help!