日期:2014-05-17 浏览次数:20672 次
public class ResponseImg : IHttpHandler
{
static readonly DateTime Refresh;
static readonly DateTime Now;
static ResponseImg()
{
Now = DateTime.Now;
Refresh = Now.AddMonths(1);
}
public void ProcessRequest(HttpContext context)
{
if (!string.IsNullOrEmpty(context.Request.Headers["If-Modified-Since"]))
{
DateTime IfModifiedSince = DateTime.Parse(context.Request.Headers["If-Modified-Since"]);
if (IfModifiedSince > Now)
{
context.Response.StatusCode = 304;
return;
}
}
//string folder = context.Request.QueryString["Folder"];
string filepath = context.Request.QueryString["FilePath"];
int width = int.Parse(context.Request.QueryString["Width"]);
int height = int.Parse(context.Request.QueryString["Height"]);
string hex = context.Request.QueryString["Hex"