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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. display a file to the browser using stream

display a file to the browser using stream

Scheduled Pinned Locked Moved C#
csharpvisual-studioquestion
4 Posts 2 Posters 1 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.
  • C Offline
    C Offline
    CodyGen
    wrote on last edited by
    #1

    Hello, I'm using the browser control of vs.net 2005 and what I am trying to do is to display a file like an image via stream and not using the physical file path. Can this be done? I have tried using the DocumentStream property but only displays the file in garbled text. Many thanks. :confused:

    H 1 Reply Last reply
    0
    • C CodyGen

      Hello, I'm using the browser control of vs.net 2005 and what I am trying to do is to display a file like an image via stream and not using the physical file path. Can this be done? I have tried using the DocumentStream property but only displays the file in garbled text. Many thanks. :confused:

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      Using the WebBrowser.DocumentStream property is correct but it depends on what your stream contains. What are the contents of your stream? The stream can only contain plain text. Anything else will just be interpreted as plain text, so binary files will not be interpretted or handled correctly. This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Customer Product-lifecycle Experience Microsoft [My Articles] [My Blog]

      C 1 Reply Last reply
      0
      • H Heath Stewart

        Using the WebBrowser.DocumentStream property is correct but it depends on what your stream contains. What are the contents of your stream? The stream can only contain plain text. Anything else will just be interpreted as plain text, so binary files will not be interpretted or handled correctly. This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Customer Product-lifecycle Experience Microsoft [My Articles] [My Blog]

        C Offline
        C Offline
        CodyGen
        wrote on last edited by
        #3

        I guess I am out of luck since I am trying to display a stream of image and a pdf. Oh well, thanks. :-)

        H 1 Reply Last reply
        0
        • C CodyGen

          I guess I am out of luck since I am trying to display a stream of image and a pdf. Oh well, thanks. :-)

          H Offline
          H Offline
          Heath Stewart
          wrote on last edited by
          #4

          You're not out of luck - there's just not a simple solution. The WebBrowser control is an ActiveX container and hosts things like MSHTML (the rendering engine for IE), Word, Acrobat (Reader), etc. It involves getting RCWs (runtime callable wrappers - a managed interface wrapping a native COM interface) and loading an IPersistFile interface (or a small handful of other, similar interfaces). Of course, you could always just navigate to the file and IE (a la the WebBrowser control) will take care of the rest. For the former method, search for "WebBrowser.DocumentStream" and you'll find some helpful tips. This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Customer Product-lifecycle Experience Microsoft [My Articles] [My Blog]

          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