asp.net mvc Route路由--忽略路由 routes.IgnoreRoute

忽略路由配置路径:

/App_Start/RouteConfig.cs

代码

    public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            routes.IgnoreRoute("WebServive/{*pathInfo}");
            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
            );
        }
    }

routes,IgnoreRoute(“WebService/{*pathInfo}”);
这句话的意思是所有请求以WebService开头的忽略路由,不通过MVC的路由,直接按照访问路径访问

发布了252 篇原创文章 · 获赞 94 · 访问量 54万+

猜你喜欢

转载自blog.csdn.net/cplvfx/article/details/102581126
今日推荐