url rewrite to serve audio file RRS feed

  • Question

  • User-1149318131 posted
    I posted a few days ago and have had time to sit down and work this out a little. Something isn't quite clicking though.

    I need for a url to be handled which doesn't point to the audio file to serve the request by sending the audio file.Here's what i have for the handler class

    using System;
    using System.Web;

    public class SongHandler : IHttpHandler
            public void ProcessRequest(HttpContext ctx)
                string dir = ctx.Request.QueryString["dir"];
                string song = ctx.Request.QueryString["tune"];
                string path = "http://www.bnymusic.com:8000/content/" + dir +"//" + song + ".pls";


            public bool IsReusable { get {return false;}}

    And for the web.config file. nested within the system.web tags

                <add verb="GET" path="*song.song" type="SongHandler" />

    i've created the handler class as a .cs file, as part of a class library, as an ashx file. and i get errors.

    When i had it in its own class library it said IHttpHandler and HttpContext couldn't be found. Missing an assembly or something. Even though i had 'using System.Web;' at the top of the file.

    When it was in it's own .cs file within my project the web.config file had problems with that line.

    Am I on the right path? Why does it seem like every path i go down just doesn't get me anywhere?

    Any help would be much appreciated.


    Thursday, May 19, 2005 8:03 PM

All replies

  • User1109032460 posted

    When you get the "missing an assembly" error, did you have a reference to the System.Web assembly in your class library project?

    Whether you put it in its own library or in a .cs file in the web project, you'll need to specify the full type name including its namespace. What is the root namespace for your project?

    Friday, May 20, 2005 5:42 AM