routes.MapPageRoute 不能用点?
routes.MapPageRoute does not work with point?
我正在使用 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>
成功了!
我正在使用 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>
成功了!