【发布时间】:2013-01-28 16:41:37
【问题描述】:
这段代码的正确用法是什么?
httpContext.Response.AddHeader("Content-Disposition", "inline; filename=" + HttpUtility.UrlPathEncode(fileName));
httpContext.Response.ContentType = "image/png";
httpContext.Response.AddHeader("Content-Length", new FileInfo(physicalFileName).Length.ToString());
httpContext.Response.TransmitFile(physicalFileName);
httpContext.Response.Flush();
httpContext.Response.End(); //Use it or not?
.Flush()和.End()真的很好用吗?
根据this,您永远不应该使用Response.End()(仅在错误或黑客攻击的情况下)
但在某些答案中,建议使用 .End()...?
喜欢this文章。
那么使用Response.End是否合适?
【问题讨论】: