routes.MapPageRoute does not work with point?

匆匆过客 提交于 2019-12-22 17:06:29

问题


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

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");

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

http://locahost/name.lastname this shows error.

Any hint? Thanks


回答1:


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

I add this to web.config

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

and it is worked!



来源:https://stackoverflow.com/questions/31514230/routes-mappageroute-does-not-work-with-point

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!