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 } }; }