473,574 Members | 3,144 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 7813
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
9565
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
2843
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
7372
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
1534
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...
0
1492
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
2147
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
3561
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...
11
2410
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 />...
9
1931
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...
0
7805
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...
0
7726
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8234
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...
1
7815
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8098
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6452
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5620
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...
1
2243
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
0
1060
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...

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.