比如在ashx文件里:
public void ProcessRequest(HttpContext context) {
context.Response.ContentType = "image/gif";
context.Response.WriteFile(strImagePath);
}
或者
context.Response.ContentType = "image/gif";
context.Response.Clear();
context.Response.BufferOutput = true;
graphics.Save(context.Response.OutputStream, ImageFormat.Jpeg);
比如在ashx文件里:
public
void
ProcessRequest(HttpContext
context)
{
context.Response.ContentType
=
"image/gif";
context.Response.WriteFile(strImagePath);
}
或者
context.Response.ContentType
=
"image/gif";
context.Response.Clear();
context.Response.BufferOutput
=
true;
graphics.Save(context.Response.OutputStream,
ImageFormat.Jpeg);
其实最好保存路径,然后在img的src中填上