public static string GetTimestampedPath(string path) { TimestampState timestampedState; if (_timestampedPaths.TryGetValue(path, out timestampedState)) { return(timestampedState.timestampedPath); } if (!_timestampedErroredPaths.Contains(path)) { // This path is not yet timestamped // => we invoke the page to compute immediatly it's timestamp try { var currentContext = HttpContext.Current; var routeData = System.Web.Routing.RouteTable.Routes.GetRouteData(new TimestampedHttpContext(path, currentContext.Request.PathInfo, currentContext)); var renderer = new LocalRenderer(); renderer.InvokeAction(routeData.Values, new FormCollection(), currentContext.Request.Url); if (_timestampedPaths.TryGetValue(path, out timestampedState)) { return(timestampedState.timestampedPath); } } catch { // This path will be ignored as we can't precompute it _timestampedErroredPaths.Add(path); throw; } } return(path); }
public static string GetTimestampedPath(string path) { TimestampState timestampedState; if (_timestampedPaths.TryGetValue(path, out timestampedState)) { return timestampedState.timestampedPath; } if (!_timestampedErroredPaths.Contains(path)) { // This path is not yet timestamped // => we invoke the page to compute immediatly it's timestamp try { var currentContext = HttpContext.Current; var routeData = System.Web.Routing.RouteTable.Routes.GetRouteData(new TimestampedHttpContext(path, currentContext.Request.PathInfo, currentContext)); var renderer = new LocalRenderer(); renderer.InvokeAction(routeData.Values, new FormCollection(), currentContext.Request.Url); if (_timestampedPaths.TryGetValue(path, out timestampedState)) { return timestampedState.timestampedPath; } } catch { // This path will be ignored as we can't precompute it _timestampedErroredPaths.Add(path); throw; } } return path; }