tags:

views:

73

answers:

1

When I convert the HTML content to MSword, a thread aborted error message occurs. Below is the error log:

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()
+1  A: 

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?

Eilon