我在下面的代码中遇到了错误(“服务器无法在发送HTTP标头后设置内容类型。”)。ContentType
这一行代码应该怎么改?
System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;
response.ClearContent();
response.ContentType = "text/plain";
response.AddHeader("Content-Disposition", "attachment; filename=" + System.IO.Path.GetFileName(PervasiveConstants.DownloadZipLocation) + ";");
response.TransmitFile(PervasiveConstants.DownloadZipLocation);
response.Flush();
response.End();
这是 Sharepoint 2010 网页部件内的内容。
ClearContent
开始?如果响应已经有内容了,那么你的代码可能运行得太晚了。 - Damien_The_Unbeliever