public void ProcessRequest(HttpContext context) { if (context == null) throw new ArgumentNullException("context"); if (context.Request == null) throw new ArgumentNullException("context.Request"); if (context.Request.Headers == null) throw new ArgumentNullException("context.Request.Headers"); if (context.Response == null) throw new ArgumentNullException("context.Response"); if (context.Server == null) throw new ArgumentNullException("context.Server"); if (CacheUtility.IsUnmodifiedSince(context.Request, GetFiles(context).Select(vf => context.Server.MapPath(vf.VirtualPath)))) { CacheUtility.NotModified(context.Response); } context.Response.ContentType = this.ContentType; SetCache(context); var response = context.Response; bool debug = Resources.Register.Debug; if (debug) { foreach (var file in GetFiles(context)) { response.Write(Environment.NewLine + Environment.NewLine + "/*** " + file.Name + " ***/" + Environment.NewLine); response.Write(Environment.NewLine); foreach (var line in ReadLines(file)) { response.Write(line); response.Write(Environment.NewLine); } } } else { context.TrySetCompressionFilter(); foreach (var file in GetFiles(context)) { response.Write(Environment.NewLine); bool commenting = false; foreach (var line in ReadLines(file)) { WriteLine(response, line, ref commenting); } } } }
public void ProcessRequest(HttpContext context) { var vpp = HostingEnvironment.VirtualPathProvider; if (!vpp.FileExists(context.Request.AppRelativeCurrentExecutionFilePath)) { context.Response.Status = "404 Not Found"; return; } if (!Resources.Register.Debug) context.TrySetCompressionFilter(); context.Response.ContentType = "text/css"; Write(context, vpp, context.Request.AppRelativeCurrentExecutionFilePath); if (!Resources.Register.Debug) { context.Response.Cache.SetLastModifiedFromFileDependencies(); context.Response.Cache.SetETagFromFileDependencies(); context.Response.Cache.SetCacheability(HttpCacheability.Public); } }
protected virtual void SetOutputCache(HttpContext context) { context.TrySetCompressionFilter(); context.Response.SetOutputCache(Utility.CurrentTime().AddDays(1)); context.Response.AddCacheDependency(new ContentCacheDependency(Engine.Persister)); }