当传递参数包含点时,asp.net mvc路由

时间:2021-07-19 17:42:43

I have very basic routing:

我有非常基本的路由:

routes.MapRoute(
                "Default",                                              
                "{controller}/{action}/{id}",parameters
                new { controller = "Home", action = "Index", id = "" }
            );  

The problem is that it works perfectly in all simple cases, like www.xxx.yy/pages/filter/test". As soon as I add dot "." to {id} part it fails, returning 'The resource cannot be found.' It happens for www.xxx.yy/pages/filter/test.

问题是它在所有简单的情况下都能很好地工作,例如www.xxx.yy / pages / filter / test“。一旦我将{。}添加到”id“部分它就会失败,返回'找不到资源“。它适用于www.xxx.yy / pages / filter / test。

Any suggestions?

2 个解决方案

#1


2  

Have a look at this post: "The resource cannot be found." error when there is a "dot" at the end of the url

看看这篇文章:“资源无法找到。”在网址末尾有“点”时出错

#2


2  

Just add a slash "/" at the end of the URL: www.xxx.yy/pages/filter/test./

只需在URL的末尾添加斜杠“/”:www.xxx.yy / pages / filter / test ./

See: Dots in URL causes 404 with ASP.NET mvc and IIS.

请参阅:URL中的点导致404使用ASP.NET mvc和IIS。

#1


2  

Have a look at this post: "The resource cannot be found." error when there is a "dot" at the end of the url

看看这篇文章:“资源无法找到。”在网址末尾有“点”时出错

#2


2  

Just add a slash "/" at the end of the URL: www.xxx.yy/pages/filter/test./

只需在URL的末尾添加斜杠“/”:www.xxx.yy / pages / filter / test ./

See: Dots in URL causes 404 with ASP.NET mvc and IIS.

请参阅:URL中的点导致404使用ASP.NET mvc和IIS。