HtmlTextWriter change settings before sending out
-
Yesterday I asked a question on how to retrieve a string of the raw html. Now the problem is that I have changed the data to byte[] and need to write it back to the HtmlTextWriter. The following is a code snippet if I am sending it to a Response value and not a text writer.
byte[] binBytes = null; StringWriter str = new StringWriter(); HtmlTextWriter html = new HtmlTextWriter(str); base.Render(html); string s = str.ToString(); binBytes = binConverter.ConvertString(s); System.Web.HttpResponse response = System.Web.HttpContext.Current.Response; response.Clear(); Response.AddHeader("Content-Type", "binary/octet-stream"); Response.AddHeader("Content-Disposition", "inline; filename=ConversionResult.bin; size=" + binBytes.Length.ToString()); Response.Flush(); Response.BinaryWrite(binBytes); Response.Flush(); Response.End(); writer.Write(s); // Writer is the original HtmlTextWriter passed to the Render function
This snippet creates will creates a second window without and leaves the original window blank. I want to do away with the second window and have it create the modified text in the original window. So the question is how can I change the reply header information from the original encoding format and assign it to a new format (text to binary)? Thanks, Leo Leo T. Smith