标签:
public class RouteConfig { public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( name: "cdn", url: "style/{appVersion}/{appChannel}/{appOs}/{pageCode}/{resourceVersion}.json", defaults: new { controller = "App", action = "Style" } ); routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller = "Account", action = "Index", id = UrlParameter.Optional } ); } }
public JsonResult Style(string appVersion, string appChannel, string appOs, string pageCode, string resourceVersion) { var request = HttpContext.Request.QueryString; request = new NameValueCollection() { {"appVersion", appVersion}, {"appChannel", appChannel}, {"appOs", appOs}, {"pageCode", pageCode}, {"resourceVersion", resourceVersion} }; var response = _appService.QueryAppConfig(request); //Response.Write(response); return new JsonResult { JsonRequestBehavior = JsonRequestBehavior.AllowGet, Data = new { success = true, content = response } }; }
C#MVC路由配置 之 动态请求伪装静态Json来欺骗CND
标签:
原文地址:http://www.cnblogs.com/zhshlimi/p/5754382.html