开发者

ASP.NET 4 Routing Problem

开发者 https://www.devze.com 2023-03-05 08:26 出处:网络
I am working on an ASP.NET 4.0 web forms project that uses page routing to serve up CMS content. The exact code used is:

I am working on an ASP.NET 4.0 web forms project that uses page routing to serve up CMS content.

The exact code used is:

routes.MapPageRoute("ContentNavigateUrl", "{*navigateurl}", "~/Router.aspx", true, new RouteValueDictionary { }, new RouteValueDictionary { { "navigateurl", @"[-_a-zA-Z0-9/]+(\.aspx(\?.+)?)?" } });

The website has a mixture of fixed aspx pages and CMS pages served up by Router.aspx.

The CMS content has URLs like /xyz/abc.

E开发者_如何学Goverything works well except when an actual folder exists and as there is no default page in the folder IIS sends a 403 error (directory browsing is not enabled).

As an example:

There is an actual folder called /xyz which has some aspx pages in it but no default page. If I request http://domain.com/xyz I get a 403 error instead of it using Router.aspx as I want it to and displaying my CMS content.

Is there an IIS setting that needs to be changed, or something in my code?

Thanks.


The issue was resolved by adding an error mapping for status code 403 to redirect to /Router.aspx in IIS.

0

精彩评论

暂无评论...
验证码 换一张
取 消