【发布时间】:2020-05-29 09:12:51
【问题描述】:
我可以为此使用 Asp.Net 路由吗?
请求的 URL = http://example.com/12345
实际行动 = http://example.com/search.aspx?id=12345
我无法弄清楚如何在我的 Global.asax 中进行设置
【问题讨论】:
我可以为此使用 Asp.Net 路由吗?
请求的 URL = http://example.com/12345
实际行动 = http://example.com/search.aspx?id=12345
我无法弄清楚如何在我的 Global.asax 中进行设置
【问题讨论】:
我找到了解决方案。我创建了自己的 System.Web.IHttpModule 处理程序并检查了 Rewrite_BeginRequest 中的 url,并将“文件夹”作为参数重定向到我的搜索页面。然后我必须在 web.config 中使用以下内容添加我的 UrlRewriteModule。
<configuration>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<add name="URLChecking" type="UrlRewriteModule"/>
</modules>
</system.webServer>
</configuration>
【讨论】: