【问题标题】:routes.MapPageRoute does not work with point?routes.MapPageRoute 不适用于点?
【发布时间】:2015-10-09 10:36:21
【问题描述】:

我正在使用 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 这显示错误。

有什么提示吗?谢谢

【问题讨论】:

    标签: c# asp.net webforms routing


    【解决方案1】:

    我认为这与扩展有关。所以,我找到了关于这个的答案。 ASP.NET Webforms routing with extension

    我将此添加到 web.config

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

    成功了!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-12-05
      • 1970-01-01
      • 1970-01-01
      • 2017-07-17
      • 2021-12-26
      • 2016-11-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多