views:

34

answers:

2

I've defined a route in Application_Start, as so many tutorials have instructed

RouteTable.Routes.Add(
            "Files",
            new Route("Files/Art",
                new FileRouteHandler()));

And created my own RouteHandler. However this doesn't seem to work at all.

When I debug the application, I can see (via a break point) that the route gets added, however when I browse to "http://localhost/MyApplication/Files/Art" I get a browser 404 (not an ASP.net 404).

When I place a break point in the Route Handler it doesn't break when I access the URL. A break point in Application_BeginRequest doesn't break either when accessing the URL.

This is a problem, but I completely understand why I get a generic 404. How would IIS know to process this URL with asp.net, after all it doesn't really exist??

What am I missing here?

+1  A: 

Make sure that you have the UrlRoutingModule installed and configured in the web.config. Something similar to what's shown below:

<system.web> 
      ... 
      <httpModules> 
         ... 
         <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
      </httpModules>
   </system.web> 
Jose Basilio
Yup, I have that in there. Same issue.
Antilogic
A: 

I knew it was a web server issue...

http://www.asp.net/%28S%28pdfrohu0ajmwt445fanvj2r3%29%29/learn/mvc/tutorial-08-vb.aspx

Short answer: With IIS 6 and below (5.1 in my case) a path such as "Files/Art" doesn't work. It won't be passed to ASP.net. However, a path such as "Files.svc/Art" will work.

The point is that IIS 6 and below needs a file extension to know what ISAPI plug in to use. In my case ".svc" is configured to use ASP.net.

Hope that makes sense...

Antilogic