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

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

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


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

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

有什么提示吗?谢谢

最佳答案

我认为这与扩展有关。因此,我找到了答案。
ASP.NET Webforms routing with extension

我将此添加到web.config

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


它是可行的!

10-06 00:35