Okay, this issue has disturbed my sleep too much this night. :)
A possible solution could be to expose a custom web server (like Cassini
[1], for example) inside your own application and serve from it all of
the contents you require. This way, coupled with a proper settings of
your WebBrowser control, could allow you to achieve the non persistance
of your resources. Note, however, that a malicious user could browse to
the web site you have exposed too, while the application is running.
But, according to your description, this should not be an issue.
[1] http://www.asp.net/Projects/Cassini/Download/
Hope this helps.
--
Efran Cobisi
http://www.cobisi.com
Efran Cobisi wrote:
Sorry Eyvind, my mistake. It seems the WebBrowser control can't display
.mht files very easily.
See
http://www.eggheadcafe.com/aspnet_answers/NETFrameworkNETWindowsFormscontrols/Feb2006/post25821366.asp
--
Efran Cobisi
http://www.cobisi.com
Eyvind Axelsen wrote:
Hi Efran, and thank you for that tip. I can, however, not get it to
work properly. What I am using as a test is an MHT page as saved from
Internet Explorer 7 based on a very very basic html page with only
one image and some lines of text on it. The output is not rendered
correctly in the .net WebBrowser control, and the image is not shown.
Is the MHT that I feed the stream supposed to be different from the
contents of an MHT file as saved by IE?
Eyvind.
-----Opprinnelig melding-----
Fra: Discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] På vegne av Efran Cobisi
Sendt: 10. mai 2007 14:06
Til: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM
Emne: Re: [ADVANCED-DOTNET] Displaying an image in a WebBrowser
without saving it to disk first (WinForms)
Eyvind,
This is easily solvable; using the DocumentStream property [1] of the
WebBrowser control would do the trick.
An example to start from:
MemoryStream stream = new MemoryStream();
StreamWriter writer = new StreamWriter(stream, Encoding.UTF8);
writer.Write(yourDynamicallyGeneratedMhtml);
writer.Flush();
stream.Position = 0;
yourWebBrowserControl.DocumentStream = stream;
[1]
http://msdn2.microsoft.com/en-us/library/system.windows.forms.webbrowser.documentstream.aspx
HTH
--
Efran Cobisi
http://www.cobisi.com
Eyvind Axelsen wrote:
Yes, I have looked at mht files, and that seems like a good option.
However, I am unable to load an mht file from an embedded resource
into the WebBrowser control. Just setting the DocumentText property
to the string contents of the mht does not work. When the mht file
resides on disk (which I do not want), displaying it via the
Navigate() method works perfectly. Any pointers would be greatly
appreciated.
Eyvind.
===================================
This list is hosted by DevelopMentor http://www.develop.com
View archives and manage your subscription(s) at
http://discuss.develop.com
===================================
This list is hosted by DevelopMentor� http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com