脚本管理器没有调用HttpContext

本文关键字:调用 HttpContext 管理器 脚本 | 更新日期: 2023-09-27 18:07:40

当我使用

ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "TTTT111", "alert('calling dfdfd from server .....');", true);

之前或之后
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.ContentType = strContentType;
HttpContext.Current.Response.AddHeader("Content-Disposition", string.Format("attachment; filename={0}", strFileName));
HttpContext.Current.Response.OutputStream.Write(ExportDataString, 0, ExportDataString.Length);
HttpContext.Current.ApplicationInstance.CompleteRequest();
HttpContext.Current.Response.OutputStream.Flush();

则不调用scriptmanager

脚本管理器没有调用HttpContext

Content-Disposition将提示用户将内容保存到磁盘。看起来您并没有在这里渲染页面。正在将ExportDataString写入流。

你期望发生什么?