这段代码的正确用法是什么?
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()
用and真的很好用.End()
吗?
根据这一点,您永远不应该使用Response.End()
(仅在错误或黑客情况下)
但是在某些答案中,.End()
建议使用...?
就像在这篇文章中一样。
那么到底该用Response.End
还是不该用呢?