route.MapPageRoute无法与点一起使用吗? [英] routes.MapPageRoute does not work with point?

查看:91
本文介绍了route.MapPageRoute无法与点一起使用吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用asp.net网络表单。在我的应用程序中,我显示用户页面,例如 http:// localhost / username

I am using asp.net webform. In my application, I show user page like http://localhost/username

在RouteConfig.cs中,我这样注册路由:

In RouteConfig.cs I register routes like this:

routes.MapPageRoute("default", "", "~/default.aspx");
routes.MapPageRoute("user", "{id}", "~/user.aspx");
routes.MapPageRoute("search", "search/{id}", "~/search.aspx");

但是当用户名包含点(。)时,它将显示404错误。

but when a username contains point (.) it shows 404 error.

http://locahost/name.lastname 会显示错误。

有任何提示吗?谢谢

推荐答案

我认为它与扩展名有关。因此,我找到了答案。
带有扩展名的ASP.NET Webforms路由

I thought it was related with extensions. So, I found an answer about this. ASP.NET Webforms routing with extension

我将此添加到web.config

I add this to web.config

<modules runAllManagedModulesForAllRequests="true" />
<handlers>
    <remove name="UrlRoutingHandler" />
</handlers>

这是可行的!

这篇关于route.MapPageRoute无法与点一起使用吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆