Public classRouteconfig { Public Static voidregisterroutes (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}); } }
PublicJsonresult Style (stringAppVersion,stringAppchannel,stringAppos,stringPagecode,stringresourceversion) { varRequest =HttpContext.Request.QueryString; Request=NewNameValueCollection () {{"appversion", appversion}, {"Appchannel", Appchannel}, {"Appos", Appos}, {"Pagecode", Pagecode}, {"resourceversion", resourceversion}}; varResponse =_appservice.queryappconfig (Request); //Response.Write (Response); return NewJsonresult {Jsonrequestbehavior=Jsonrequestbehavior.allowget, Data=New{Success=true, Content=response}}; }
C#MVC the dynamic request of the routing configuration to spoof the static JSON to deceive the CND