当我将HTML内容转换为MS Word时,会发生线程中止错误消息。以下是错误日志:
HttpContext.Current.Response.Clear()
HttpContext.Current.Response.Charset = ""
HttpContext.Current.Response.ContentType = "application/msword"
Dim strFileName As String = "GenerateDocument" + ".doc"
HttpContext.Current.Response.AddHeader("Content-Disposition", "inline;filename=" + strFileName)
Dim strHTMLContent As New StringBuilder()
HttpContext.Current.Response.Write(strHTMLContent)
HttpContext.Current.Response.Flush()
HttpContext.Current.Response.End()
答案 0 :(得分:1)
致电Response.End()
始终会产生ThreadAbortException
。
这会导致任何问题,或者您只是想知道为什么会这样?
另外,我在您的代码中看到您声明了一个新的StringBuilder
,从不向其添加任何文本,然后将其写入响应。这将永远是空的 - 这是故意的吗?