ASP.NET MVC 3中嵌入的PHP站点的IgnoreRoute
我有一个带有嵌入式worpress博客的MVC3站点。以下所有URL都通过MVC定向ASP.NET MVC 3中嵌入的PHP站点的IgnoreRoute,php,asp.net,iis,asp.net-mvc-3,ignoreroute,Php,Asp.net,Iis,Asp.net Mvc 3,Ignoreroute,我有一个带有嵌入式worpress博客的MVC3站点。以下所有URL都通过MVC定向 www.mysite.com www.mysite.com/aboutus www.mysite.com/contactus 我还有一个名为Blog的顶级目录,它是一个php wordpress博客。如果我访问www.mysite.com/blog/index.php,博客就会显示出来。但是对www.mysite.com/blog的所有访问似乎都是通过MVC路由的,并且产生了一个与System.Web.He
www.mysite.com
www.mysite.com/aboutus
www.mysite.com/contactus
我还有一个名为Blog的顶级目录,它是一个php wordpress博客。如果我访问www.mysite.com/blog/index.php
,博客就会显示出来。但是对www.mysite.com/blog
的所有访问似乎都是通过MVC路由的,并且产生了一个与System.Web.Helpers
相关的错误(我将其部署到了bin文件夹中,所以我知道这不是问题所在)
在我的Global.asax.cs
文件的RegisterRoutes
方法中,我在方法的顶部尝试了这两行,但两行似乎都不起作用
routes.IgnoreRoute("Blog");
routes.IgnoreRoute("{folder}/{*pathinfo}", new { folder = "Blog" });
有人有主意吗
根据史努比的要求,我已将Global.asax.cs的内容包括在内:
public class MvcApplication : System.Web.HttpApplication
{
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
filters.Add(new HandleErrorAttribute());
}
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("Blog");
routes.IgnoreRoute("{folder}/{*pathinfo}", new { folder = "Blog" });
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
}
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
RegisterGlobalFilters(GlobalFilters.Filters);
RegisterRoutes(RouteTable.Routes);
}
}
使用此选项可忽略文件夹“Blog”的路由
使用此选项可忽略文件夹“Blog”的路由
使用
Routes.IgnoreRoute(“Blog/”)代码>还记得将其放在路由表的第一位
这可能是关于结尾处缺少的/
使用Routes.IgnoreRoute(“Blog/”)代码>还记得将其放在路由表的第一位
可能是因为结尾处缺少了/
,请张贴完整的注册表。请张贴完整的注册表。有没有幸运绕过这个?有没有幸运绕过这个?
routes.IgnoreRoute("Blog/{*pathInfo}");