【发布时间】:2010-09-21 08:49:48
【问题描述】:
我正在使用 .NET 3.5 SP1 框架,并且在我的应用程序中实现了 URL 路由。我收到了 javascript 错误:
Error: ASP.NET Ajax client-side framework failed to load.
Resource interpreted as script but transferred with MIME type text/html.
ReferenceError: Can't find variable: Sys
我认为这是因为我的路由选择了 microsoft axd 文件,而没有正确发送 javascript。我做了一些研究,发现我可以使用Routes.IgnoreRoute,这应该可以让我忽略下面的axd:
Routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
但是,当我将该行添加到我的 Global.asax 时,我收到了这个错误:
CS1061: 'System.Web.Routing.RouteCollection' does not contain a definition for 'IgnoreRoute' and no extension method 'IgnoreRoute' accepting a first argument of type 'System.Web.Routing.RouteCollection' could be found (are you missing a using directive or an assembly reference?)
我已经导入了 System.Web.Routing 命名空间,有什么想法吗?
【问题讨论】:
标签: c# asp.net url-routing axd ignoreroute