public static void Register( RouteCollection routes, TimeSpan?maxAge = null, string version = null) { CachedRoute sc = new CachedRoute(); sc.MaxAge = maxAge == null?TimeSpan.FromDays(30) : maxAge.Value; if (string.IsNullOrWhiteSpace(version)) { version = System.Web.Configuration.WebConfigurationManager.AppSettings["Static-Content-Version"]; if (string.IsNullOrWhiteSpace(version)) { version = Assembly.GetExecutingAssembly().GetName().Version.ToString(); } } Version = version; var route = new Route("cached/{version}/{*name}", sc); route.Defaults = new RouteValueDictionary(); route.Defaults["version"] = "1"; routes.Add(route); }
public static void Register( RouteCollection routes, TimeSpan? maxAge = null, string version = null) { CachedRoute sc = new CachedRoute(); sc.MaxAge = maxAge == null ? TimeSpan.FromDays(30) : maxAge.Value; if (string.IsNullOrWhiteSpace(version)) { version = System.Web.Configuration.WebConfigurationManager.AppSettings["Static-Content-Version"]; if (string.IsNullOrWhiteSpace(version)) { version = Assembly.GetExecutingAssembly().GetName().Version.ToString(); } } Version = version; var route = new Route("cached/{version}/{*name}", sc); route.Defaults = new RouteValueDictionary(); route.Defaults["version"] = "1"; routes.Add(route); }