2011-09-18 84 views
0

在Global.asax的应用开始,我有为什么我的URL路由不起作用?

Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) 
     RegisterRoutes(RouteTable.Routes) 
End Sub 

Private Sub RegisterRoutes(ByVal routes As RouteCollection) 
    routes.MapPageRoute("contactform", "{locale}/contact", "~/general/ContactUs.aspx") 
End Sub 

是goimg就怪了,就是当我访问的网页直接

~/general/contactus.aspx 

一切像魅力一样工作,但当我间接访问页面时

~/en/contact 

返回404错误!我在这里错过了什么吗?

回答

1

这可能与多种事情有关。我首先要看的是:

确保您的应用程序在IIS 7.0或+下运行。

确保您的应用程序在IIS 7或IIS 7.5内的集成模式应用程序池下运行。

确保你有你的web.config文件中的以下代码:

<system.webServer> 
    <modules runAllManagedModulesForAllRequests="true" /> 
</system.webServer> 

不知道,但是虽然上面的代码不应该在IIS 7.5是必要的。 这应该已经配置为IIS 7.5开箱即用。

相关问题