Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. HtmlTextWriter change settings before sending out

HtmlTextWriter change settings before sending out

Scheduled Pinned Locked Moved ASP.NET
questionhtmlhelptutorial
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Leo Smith
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups