My web site has a handler (FileDownload.ashx) that deals with all file download requests.
I've recently migrated my site to ASP.NET 4.0, and it now uses routing extensively. Everything works fine when dealing with page requests (aspx), but it's not working with my handler - I encounter the following error:
Type '.Handlers.FileDownload' does not inherit from 'System.Web.UI.Page'.
This makes sense, as routing is only implemented in the page.
What steps do I need to take to be able to use routing and my .ashx together? I want to be able to extract RouteData.Values
from the route.
public class FileDownload : IHttpHandler
{
}
I needed to hand craft a handler in the end, but it was easy enough: http://haacked.com/archive/2009/11/04/routehandler-for-http-handlers.aspx
.Net 4.0 does not natively support route handling for IHttpHandlers.