我在我的一个 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 Redirection更新了我的 IIS
但没有什么对我有用。
还有其他我遗漏的部分吗?
编辑: 我收到以下错误,即找不到 404 文件;