【问题标题】:Route to convert 'folder' to search将“文件夹”转换为搜索的路线
【发布时间】:2020-05-29 09:12:51
【问题描述】:

我可以为此使用 Asp.Net 路由吗?

请求的 URL = http://example.com/12345

实际行动 = http://example.com/search.aspx?id=12345

我无法弄清楚如何在我的 Global.asax 中进行设置

【问题讨论】:

    标签: asp.net routes


    【解决方案1】:

    我找到了解决方案。我创建了自己的 System.Web.IHttpModule 处理程序并检查了 Rewrite_BeginRequest 中的 url,并将“文件夹”作为参数重定向到我的搜索页面。然后我必须在 web.config 中使用以下内容添加我的 UrlRewriteModule。

        <configuration>
            <system.webServer>
                <modules runAllManagedModulesForAllRequests="true">
                    <add name="URLChecking" type="UrlRewriteModule"/>
                </modules>
            </system.webServer>
        </configuration>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-09-24
      • 1970-01-01
      • 2022-08-17
      相关资源
      最近更新 更多