473,737 Members | 1,836 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 7854
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.Out put 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******** ********@TK2MSF TNGP14.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.Out put 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******** ************@ne ws.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******** ********@TK2MSF TNGP14.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.Out put 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:blan k"
- handle the DocumentComplet e event like so:

AxWebBrowser browser = ...;
MSHTML.IHTMLDoc ument2 doc = (MSHTML.IHTMLDo cument2)browser .Document;
doc.body.innerH TML = "<body><p>H ello 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******** ************@ne ws.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
9580
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). both files are in the /cgi/ folder
2
2860
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 any html from the xml file as text, ie its displaying as text <br/> and <b> etc
3
7377
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 browser window is displayed, preferably with no menu or tool bars.... Cheers Jim
1
1541
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 a file (it will be built as I go along). I can use the <asp:xml> control, but I don't want to have to write the XSLT, I love the one I get for free within IFrame.
0
1509
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. Create two button_click events with the following code in it For button1 Help.ShowHelpIndex(Me, "C:\Temp\File1 mspaint.chm")
5
2155
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 header('Content-type: image/jpeg'); $link = mysql_connect('localhost', 'root', ''); if (!$link) {
0
3575
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 into a single MIME encoded file that specifies all of the resources for a page in a single file. This makes a lot of sense as if you could pass one of these to the
11
2426
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;?>"> First Name:<input type="text" size="12" maxlength="12" name="Fname"><br > Last Name:<input type="text" size="12" maxlength="36" name="Lname"><br /> Gender:<br /> Male:<input type="radio" value="Male" name="gender"><br /> Female:<input...
9
1939
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 ran the sql statement directly in mysql and it gives me results. any help is greatly appreciated <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
0
8965
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9466
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9330
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6748
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6050
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4567
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3278
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2741
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2191
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.