3

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.

2
  • How do you get your iis6 running with mvc none extension based routing? - Do you used wildcard mapping, url rewriting, *.mvc extension or any other workaround? Commented Aug 20, 2010 at 20:29
  • I think we are using wildcard mapping. Commented Aug 20, 2010 at 20:47

2 Answers 2

1

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!

Sign up to request clarification or add additional context in comments.

Comments

0

I know this has already been answered by thought this might help someone. In your web.config you may need to add runAllManagedModulesForAllRequests="true"

<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="true" />

Hope this helps someone.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.