raynjamin
raynjamin

Reputation: 788

Directory in MVC3 Project

I have a "Tools" area of the MVC3 site I'm currently working on. One of the tools I'm integrating on the site I need to run in a virtual directory. Setting up a virtual directory under the /Tools folder works fine for the app itself, but for navigation to /Tools/, I'm getting "Directory listing not allowed". How do I tell IIS to let MVC routes handle this URL?

We'll be using IIS6 in production, so it's important for it to work with that.

Thanks in advance.

EDIT: For clarity, here's the setup:

The routes for the routed tools work fine, but since I had to create a directory under the root to setup the "ToolInVirtualDirectory", IIS is hijacking the "/Tools/" request and trying to send it to the directory, ignoring the route.

Upvotes: 2

Views: 145

Answers (2)

Erik Funkenbusch
Erik Funkenbusch

Reputation: 93464

In your RegisterRoutes section in Global.asax, you add ignore routes that the routing system ignores. There should already be an example for .axd's in the config.

Upvotes: 0

VJAI
VJAI

Reputation: 32768

You should set routes.RouteExistingFiles = true in Global.asax.cs.

Remember that since this property plays at global level you have to ignore the css files and other stuff you don't need to handle by the routing infrstructure before setting this. For more idea please refer this post.

Upvotes: 1

Related Questions