views:

54

answers:

1

I have a controller action that has the same name as a file path. Like:

www.example.com/userfiles/path/to/userfile.jpg

Basically I have a userfiles controller and on the index action everything after userfiles/ is a path. There is also a userfiles virtual directory in the root of my application. What I want to happen is that if the directory that follows userfiles/ (in this case path) does not exist in the userfiles virtual directory, then use the index action on the userfilesController if the directory does exist, then use the path as it is.

This worked flawlessly on my windows xp dev machine running iis 5. But, once I moved it to the live server(Windows server 2003 iis 6), I get a 404 error as if the path does not exist rather than going to the userfiles controller index action.

In the routes file I have:

routes.MapRoute(
    "Userfiles",                                       // Route name
    "userfiles/{*url}",                                // URL with parameters
    new { controller = "Userfiles", action = "Index" } // Parameter defaults
);

What am I missing? It was working so well.

+1  A: 

So I found out that my issue was that we did have wildcard mapping enable for the site however, we also had turned it off for certain directories because of performance. I have re-enabled the wildcard for the directory in question and it all started working as it had on my dev box. Joy!

smartdirt