日期:2014-05-18 浏览次数:20442 次
context.Response.Cache.SetExpires(DateTime.Now.Add(new TimeSpan(7,0,0,0))); context.Response.Cache.SetCacheability(HttpCacheability.Public); context.Response.Cache.SetValidUntilExpires(false); switch (extension) { case "jpg": context.Response.ContentType = "image/jpeg"; break; case "png": context.Response.ContentType = "image/png"; break; case "gif": context.Response.ContentType = "image/gif"; break; case "swf": context.Response.ContentType = "application/x-shockwave-flash"; break; case "css": context.Response.ContentType = "text/css"; break; case "js": context.Response.ContentType = "application/x-javascript"; break; } context.Response.AddHeader("content-disposition", "inline; filename=" + filename); context.Response.WriteFile(file); }