473,416 Members | 1,740 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

Displaying HTML from memory

Hi

I have many short HTML files stored in a binary stream storage to display
descriptions for various items in application. HTML would be display inside
application using some .NET control or COM control (like Microsoft
WebBrowser). For each description there is one HTML file and along
description text, it contains links to related information. Clicking related
information would for example open new form in application and display some
list of items from DB.

When I load HTML data from stream storage, it is stored in memory inside
memory stream. I could display HTML data by first saving memory stream
contents in a temporary file and then instruct browser control to load from
that file, but I absolutely don't want to use temporary files in this
process. I want to display HTML data directly from the memory stream (or
some other form of memory storage). Is there any control available for C#
that can display HTML data directly from memory?

regards
Tomaz

Nov 17 '05 #1
5 7766
Tomaz Koritnik,

The web browser expects an URL that could be a file or a URL for a internet
resource that is served by some web server. There is no way that you can
pass a memory stream. Of course it depends on the web browser control. If
you use some special control that accepts that then go for it. If you are
using control like IE what you can do is to create a simple ASP.NET
application with a single page. This page can read the name of the web page,
you want to display, as a parameter. The ASP.NET page then can read the
stream and flush its contents to the HttpRespond.Output stream.

For this solution though you need IIS running on the machine. However,
easiest solution would be to save the stream in a file and point the borwser
to it.

HTH
Stoitcho Goutsev (100) [C# MVP]
"Tomaz Koritnik" <no****@nospam.com> wrote in message
news:d8*********@planja.arnes.si...
Hi

I have many short HTML files stored in a binary stream storage to display
descriptions for various items in application. HTML would be display
inside
application using some .NET control or COM control (like Microsoft
WebBrowser). For each description there is one HTML file and along
description text, it contains links to related information. Clicking
related
information would for example open new form in application and display
some
list of items from DB.

When I load HTML data from stream storage, it is stored in memory inside
memory stream. I could display HTML data by first saving memory stream
contents in a temporary file and then instruct browser control to load
from
that file, but I absolutely don't want to use temporary files in this
process. I want to display HTML data directly from the memory stream (or
some other form of memory storage). Is there any control available for C#
that can display HTML data directly from memory?

regards
Tomaz

Nov 17 '05 #2
Hi

Thanks but I know that IE browser does not support displaying HTML files
from memory. IIS is out of the questione and I still don'w want to save HTML
to temporary file :). That's why I'm trying to find some other HTML
displaying component that can do this because I don't know if there are any.
Do you know?

regards
Tomaz

"Stoitcho Goutsev (100) [C# MVP]" <10*@100.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
Tomaz Koritnik,

The web browser expects an URL that could be a file or a URL for a
internet resource that is served by some web server. There is no way that
you can pass a memory stream. Of course it depends on the web browser
control. If you use some special control that accepts that then go for it.
If you are using control like IE what you can do is to create a simple
ASP.NET application with a single page. This page can read the name of the
web page, you want to display, as a parameter. The ASP.NET page then can
read the stream and flush its contents to the HttpRespond.Output stream.

For this solution though you need IIS running on the machine. However,
easiest solution would be to save the stream in a file and point the
borwser to it.

HTH
Stoitcho Goutsev (100) [C# MVP]
"Tomaz Koritnik" <no****@nospam.com> wrote in message
news:d8*********@planja.arnes.si...
Hi

I have many short HTML files stored in a binary stream storage to display
descriptions for various items in application. HTML would be display
inside
application using some .NET control or COM control (like Microsoft
WebBrowser). For each description there is one HTML file and along
description text, it contains links to related information. Clicking
related
information would for example open new form in application and display
some
list of items from DB.

When I load HTML data from stream storage, it is stored in memory inside
memory stream. I could display HTML data by first saving memory stream
contents in a temporary file and then instruct browser control to load
from
that file, but I absolutely don't want to use temporary files in this
process. I want to display HTML data directly from the memory stream (or
some other form of memory storage). Is there any control available for C#
that can display HTML data directly from memory?

regards
Tomaz


Nov 17 '05 #3
Unfortunately I don't know either. Hopefully the others in the group can
help.
--
Stoitcho Goutsev (100) [C# MVP]

"Tomaz Koritnik" <no****@nospam.com> wrote in message
news:Z4********************@news.siol.net...
Hi

Thanks but I know that IE browser does not support displaying HTML files
from memory. IIS is out of the questione and I still don'w want to save
HTML to temporary file :). That's why I'm trying to find some other HTML
displaying component that can do this because I don't know if there are
any. Do you know?

regards
Tomaz

"Stoitcho Goutsev (100) [C# MVP]" <10*@100.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
Tomaz Koritnik,

The web browser expects an URL that could be a file or a URL for a
internet resource that is served by some web server. There is no way that
you can pass a memory stream. Of course it depends on the web browser
control. If you use some special control that accepts that then go for
it. If you are using control like IE what you can do is to create a
simple ASP.NET application with a single page. This page can read the
name of the web page, you want to display, as a parameter. The ASP.NET
page then can read the stream and flush its contents to the
HttpRespond.Output stream.

For this solution though you need IIS running on the machine. However,
easiest solution would be to save the stream in a file and point the
borwser to it.

HTH
Stoitcho Goutsev (100) [C# MVP]
"Tomaz Koritnik" <no****@nospam.com> wrote in message
news:d8*********@planja.arnes.si...
Hi

I have many short HTML files stored in a binary stream storage to
display
descriptions for various items in application. HTML would be display
inside
application using some .NET control or COM control (like Microsoft
WebBrowser). For each description there is one HTML file and along
description text, it contains links to related information. Clicking
related
information would for example open new form in application and display
some
list of items from DB.

When I load HTML data from stream storage, it is stored in memory inside
memory stream. I could display HTML data by first saving memory stream
contents in a temporary file and then instruct browser control to load
from
that file, but I absolutely don't want to use temporary files in this
process. I want to display HTML data directly from the memory stream (or
some other form of memory storage). Is there any control available for
C#
that can display HTML data directly from memory?

regards
Tomaz



Nov 17 '05 #4
It is possible to load a HTML string into the AxWebBrowser control. In order
to do this, you first need to navigate the control somewhere so that it will
have the HTML DOM in place. You can then replace the body with your HTML
string. In other words:

- navigate the control to url "about:blank"
- handle the DocumentComplete event like so:

AxWebBrowser browser = ...;
MSHTML.IHTMLDocument2 doc = (MSHTML.IHTMLDocument2)browser.Document;
doc.body.innerHTML = "<body><p>Hello World!</p></body>";

I'm not sure if it is possible to access the header this way, though.

Regards,
Sami

"Tomaz Koritnik" <no****@nospam.com> wrote in message
news:d8*********@planja.arnes.si...
Hi

I have many short HTML files stored in a binary stream storage to display
descriptions for various items in application. HTML would be display
inside
application using some .NET control or COM control (like Microsoft
WebBrowser). For each description there is one HTML file and along
description text, it contains links to related information. Clicking
related
information would for example open new form in application and display
some
list of items from DB.

When I load HTML data from stream storage, it is stored in memory inside
memory stream. I could display HTML data by first saving memory stream
contents in a temporary file and then instruct browser control to load
from
that file, but I absolutely don't want to use temporary files in this
process. I want to display HTML data directly from the memory stream (or
some other form of memory storage). Is there any control available for C#
that can display HTML data directly from memory?

regards
Tomaz

Nov 17 '05 #5
"Tomaz Koritnik" <no****@nospam.com> wrote in message
news:Z4********************@news.siol.net...
Hi

Thanks but I know that IE browser does not support displaying HTML files
from memory.


Actually it does. The details are simple for those who played with the
control low-level (we're talking COM interfaces here) but they've always
been slightly beyond my reach. I remember finding the low-level details in
an open-source project called HtmlEditor:
http://www.itwriting.com/htmleditor/index.php
If you check the source code you'll find that it's all there. You might need
to get rid of some of the additional complexity due to the "editor" bits
that you don't need.

The good news are that in the oncoming version 2.0 of the framework (now in
beta) you'll be able to do this natively because all the relevant interfaces
have been wrapped already. I tried and it just works(tm) :)
--
WildHeart'2k5
Nov 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: matthiasjanes | last post by:
Hi, Maybe someone of you can help me. I'm trying to display an image in memory(open file) with an cgi script - but it want work proberly: I'm running an Cgi webserver (CgiServerGui.py). ...
2
by: Joe Price | last post by:
Hi chaps I've got an XML file, within that file i've embedded html code using the <!]> tag I'm displaying that xml file through a browser using an xsl style sheet. However it is displaying...
3
by: | last post by:
I have a pdf that is contained in a byte array in memory and I want to display this in a browser window. The window will beopenned when a button is clicked on the current web page, i.e. a second...
1
by: Jesse Liberty | last post by:
Hi. I'd like to create an xml document on the fly and then display it in an asp.net page. I can use an iframe and point to a URL (which displays perfectly), but I'd not like to save the xml to...
0
by: Yabedabe | last post by:
Hello there, I have a strange problem (possible bug?) to display two HTML Help files at the same time. To reproduce this problem. Create a new VB.Net solution. Place two buttons on the form....
5
by: ljuljacka | last post by:
I'm trying to display resized images. Locations of images are fetched from database. The problem is that with the following code, I get only the first image displayed: <?php...
0
by: Andy Bates | last post by:
Hi - This issue seems to have been kicking around since the dawn of time and no one appears to have come up with an answer. In short the MHT/MSHTML provides a method of archiving an HTML page...
11
by: dba | last post by:
Have been displaying data from database using html for some time but just recently trying to display data back to "form". Can't find answer. <form method="post" action="<?php echo $PHP_SELF;?>">...
9
by: whitep8 | last post by:
Hi All, The following script will display the grid, with its headers but will not display any data. Im sure ive made a mistake in the syntax somewhere but i can see the wood for the trees. Ive...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.