When I convert the HTML content to MS Word, a thread aborted error message occurs. Below is the error log:
HttpContext.Current.Re开发者_开发百科sponse.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()
Calling Response.End()
always results in a ThreadAbortException
.
Is that causing any problems or are you just wondering why it is happening?
Also, I see in your code you are declaring a new StringBuilder
, never adding any text to it, and then writing it out to the response. This will always be empty - is that deliberate?
精彩评论