【发布时间】:2013-02-21 05:34:54
【问题描述】:
我在我的一个 asp.net 项目中使用路由,它不使用 MVC 架构... 它可以在我的 PC 甚至 Windows Server 2003 上运行。
下面是我的 global.asax 文件代码:
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
If ConfigurationManager.AppSettings("SeoFriendlyUrl") = "true" Then
RegisterRoutes(RouteTable.Routes)
End If
End Sub
Public Shared Sub RegisterRoutes(routes As RouteCollection)
routes.MapPageRoute("HomePage", "", "~/index.aspx", True)
routes.MapPageRoute("SignUpRoute", "SignUp", "~/Register.aspx", True)
routes.MapPageRoute("WorkWithUsRoute", "Work-With-Us", "~/WorkWithUs.aspx", True)
routes.MapPageRoute("AdvertiseWithUsRoute", "Advertise-With-Us", "~/AdvertiseWithUs.aspx", True)
routes.MapPageRoute("PrivacyRoute", "PrivacyPolicy", "~/PrivacyPolicy.aspx", True)
routes.MapPageRoute("NewsLetterRoute", "Get-Alerts", "~/NewsLetters.aspx", True)
End Sub
我在搜索问题时尝试了以下方法: web.config 中的更改:
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
还有:
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<remove name="UrlRoutingModule"/>
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</modules>
<handlers>
<add
name="UrlRoutingHandler" preCondition="integratedMode" verb="*" path="UrlRouting.axd" type="System.Web.HttpForbiddenHandler, System.Web,
Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a"/>
</handlers>
</system.webServer>
并使用 Http 重定向
更新了我的 IIS但对我没有任何作用。
还有没有我遗漏的部分?
编辑: 我收到以下错误,即找不到 404 文件;
【问题讨论】:
标签: asp.net vb.net routing iis-7.5 windows-server-2008-r2