cs0815
cs0815

Reputation: 17418

routing problem

I have an actual folder with the same name as a controller. So the resulting link from this:

<li><%= Html.ActionLinkForAreas<BlaController>(c => c.Index(1), "BlaDiBla")%></li>

e.g.

www.bla.com/foldername (where foldername = controller name)

Stopped working.

I am wondering how I can avoid this behaviour as easy as possible (I need the folder with the same name though).

Thanks.

Best wishes,

Christian

Upvotes: 1

Views: 143

Answers (1)

Philip Rieck
Philip Rieck

Reputation: 32578

IIS does not get priority, but the ASP.net routing engine in System.Web.Routing looks for physical files (or directories) before looking at the Routes you have defined.

You can switch this at a global level with the RouteCollection.RouteExistingFiles property, which will then give your route definitions priority over the file system. Make sure you test all your routes when you change this!

See also this question Considerations when turning on RouteExistingFiles.

Upvotes: 2

Related Questions