Mapping mp3's to the aspnet executable

Discussion in 'ASP.NET 2.0' started by PureWeen, Jun 7, 2007.

  1. It works super on my local system I just can't get it working on my DISCOUNTasp.net account.
    So on my local system I click an mp3 file and it starts downloading it....where as on my discountasp.net server it does
    http://www.cyberfetishdolls.com/UPLOAD/MUSIC/PureWeen/Songs/
    Click on the mp3's there

    My settings on local are defined below and the people at discount told me it's identical on there server.. yet it's still not working ..
    ideas?

    On my local I have the extension .mp3 mapped to the executable
    C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll
    Verbs:
    GET,HEAD,POST,DEBUG
    Script Engine : CHECKED
    Check that file exists: CHECKED

    Than My /UPLOAD/MUSIC has Execute Permissions set at : Script Only

    and it works fine..
    Is there another setting I'm missing in the Discountasp.net's control panel that I need to set?
     
  2. I clicked on the specified link and I get an option to download it (Firefox)?Is that what you looking for? I believe there is an issue with IE? I dont think its a server issue.

    Vikram

    DiscountASP.NET
    www.DiscountASP.NET

    Post Edited (vvsharma) : 6/7/2007 8:58:45 PM GMT
     
  3. If your purpose is just downloading the mp3 from your site,why do you even need the 'mp3' extension mapped to the ASP.NET dll? If for any reason,you want the mapping ,you need to create a handler to handle the requests for (.mp3).

    Vikram

    DiscountASP.NET
    www.DiscountASP.NET

    Post Edited (vvsharma) : 6/7/2007 10:04:07 PM GMT
     
  4. cause then I can do in code statistics on the mp3 downloaded

    I can write an HttpHandler or even in the GLOBAL.asax file during the begin request event see what mp3 is being downloaded the save a variety of statistics based on the person requesting the file..

    or maybe I Just want to implement a basic URL Rewriter

    or maybe...........
     

  5. Hmm I don't think that's correct.. I didn't have to do anything of the sort on my local box....All I did was set .mp3's to be handled by the aspnet dll and they still downloaded fine without having to change or add a single thing to my code. I've done so on a variety of websites...


    I have one site where every extension is handled by the aspnet.dll because it implements a basic URL REWriter so everything has to be handled by the .net engine
     
  6. ASP.NET 2.0 works differently on how mappings are handled.The problemis the default handler, which is a global setting on the server:

    <add path="*" verb="GET,HEAD,POST" type="System.Web.DefaultHttpHandler" validate="True" />

    If youadd amapping fora specificextension, then you'll definitely need a handler for that extension. Otherwise, let's see what will happen to the request with the default handler...

    1. IIS gets a request for an MP3 file.
    2. IIS sees that there's a mapping for .mp3 to ASP.NET 2.0. It passes it on to ASP.NET 2.0.
    3. ASP.NET 2.0 (your web app), doesn't see any httpHandler for .mp3, so it uses the default handler.
    4. The default handler will do some checks like if authentication is required, etc. Then it passes the request back to IIS (this is how it works). Go back to step 1.

    As you can see, the request is now stuck in a loop and you will see weird things happening depending on your browser. In Firefox, you'll get a 0kb file, and IE can't display the page.

    So if you don't plan on doing any custom handling for .mp3 now, it's best not to add the mapping.

    Aristotle

    DiscountASP.NET
    www.DiscountASP.NET
     
  7. Sweet that makes perfect sense :)
    I just added




    <add verb="GET" path="*.mp3" type="System.Web.StaticFileHandler" />


    And now it all works perfectly.


    Thanks
     

Share This Page