asp.net mvc route clashing with physical path in IIS7

Posted by Andrew Bullock on Stack Overflow See other posts from Stack Overflow or by Andrew Bullock
Published on 2010-05-20T12:35:20Z Indexed on 2010/05/20 14:40 UTC
Read the original article Hit count: 233

Filed under:
|
|

I'm messing about with controller organisation and I've hit a problem.

If I have the following physical structure

/Home/HomeController.cs
/Home/Index.aspx
/Home/About.aspx

and I request the URI:

/Home/Index

I get a 403 Directory Listing Denied :(

(im using a custom IControllerFactory and IViewEngine to look in this non-default path)

Why is this happening? (I know the 403 is because its hitting the /Home folder, but why is it hitting the folder?)

Why doesn't the UrlRoutingModule rewrite the route and let the controller pick up the request?

Application_BeginRequest fires, but then it seems to pass control back to IIS to try and serve from the filesystem.

Is it the UrlRoutingModule that defaults to a physical path if it exists before rewriting?

Is there a way to make this work?

N.B. Please don't suggest relocating my controllers etc. I know this is an obvious option, but that isn't the question ;)

Using IIS7 In Integrated Mode

Thanks

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about iis