当前位置:首页 > Windows程序 > 正文

如何:对 Web 窗体使用路由

2021-03-29 Windows程序

标签:

配置用于路由的 ASP.NET 网站项目

1. 在应用程序的 Web.config 文件中,将 ASP.NET 路由程序集添加到 assemblies 元素,如下面的示例所示:

<add assembly="System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

2. 如果应用程序在 IIS 6.0 或 IIS 7.0 经典模型下运行,,则将 UrlRoutingModule 类添加到 httpModules 元素,如下面的示例所示:
<httpModules> <add type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> </httpModules>

3. 如果应用程序在 IIS 7.0 集成模式下运行,则将 UrlRoutingModule 类添加到 modules 元素,如下面的示例所示: <system.webServer> <modules> <remove /> <add type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> </modules> </system.webServer>

4. 如果应用程序在 IIS 7.0 集成模式下运行,则将 UrlRoutingHandler 类添加到 handlers 元素,如下面的示例所示:
<system.webServer> <handlers> <add preCondition="integratedMode" verb="*" path="UrlRouting.axd" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> </handlers> </system.webServer>
原文:https://msdn.microsoft.com/zh-cn/library/cc668202(v=vs.100).aspx
 

如何:对 Web 窗体使用路由

温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/file/69822.html