Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / October 2007

Tip: Looking for answers? Try searching our database.

Deny Access to MP3 folder

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
asadikhan@gmail.com - 31 Oct 2007 20:09 GMT
Hi,

I have an Audio folder under WWW on my website. My site is hosted with
an online company. Inside the Audio folder I have bunch of mp3s. I
want to embed these mp3s using flash, but I do not want to allow users
to simply browse to the mp3 file and be able to download it. Here is
my web.config file:

<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/
v2.0">
    <appSettings/>
 <location path="Audio">
   <system.web>
     <compilation debug="true"/>
     <authorization>
       <deny users="*"/>
     </authorization>
   </system.web>
 </location>
 <location path="Audio/mysong.mp3">
   <system.web>
     <compilation debug="true"/>
     <authorization>
       <deny users="*"/>
     </authorization>
   </system.web>
 </location>
</configuration>

After doing this if I browse to www.mysite.com/Audio it tell me that
the directory listing is not permitted. However, I can still browse to
the song file and create external links to it and download it. Any
ideas?
Mark Fitzpatrick - 31 Oct 2007 21:38 GMT
The web.config settings won't work in this case. The web.config only affects
files that are handled by files that can be processed by ASP.Net. An mp3
file is not handed off to the ASP.Net handler for processing so there's no
way for it to be denied access. You would have to map the mp3 file extension
with ASP.Net's processing dll which, unless you're on a dedicated server,
your host isn't likely to allow. And if you did map it, you would
effectively deny access to the file no matter what since you're telling it
to deny access to all users, including the ASP.Net application or any link
that goes directly to it. The virtual directory listing is a function of IIS
so ASP.Net actually isn't blocking anything here, just a typical IIS
setting.

The best way to avoid users simply downloading a file is to have it streamed
through a streaming audio server. You can do other methods, such as having a
page that you can pass an id to and have it pull the file from somewhere
that's hidden in the file system (ideally outside of the directory that the
web site is mapped to), but users would still have access to the link and be
able to download it anyways.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - Expression

> Hi,
>
[quoted text clipped - 30 lines]
> the song file and create external links to it and download it. Any
> ideas?
Peter Bromberg [C# MVP] - 31 Oct 2007 21:55 GMT
The easiest way to handle this is to have the mp3 folder outside of the IIS
application (not in the web). As long as your streamer is capable of loading
these from a physical path, e.g. c:\mp3s\songName.mp3   then it should work.
-- Peter
site:  http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder:    http://www.blogmetafinder.com

> Hi,
>
[quoted text clipped - 30 lines]
> the song file and create external links to it and download it. Any
> ideas?

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.