Click here to Skip to main content
15,881,281 members
Home / Discussions / C#
   

C#

 
GeneralRe: Can I pass binary data of a file to WebBrowser control? Pin
Luc Pattyn10-Jun-10 8:18
sitebuilderLuc Pattyn10-Jun-10 8:18 
GeneralRe: Can I pass binary data of a file to WebBrowser control? Pin
Hristo-Bojilov10-Jun-10 10:51
Hristo-Bojilov10-Jun-10 10:51 
GeneralRe: Can I pass binary data of a file to WebBrowser control? Pin
Luc Pattyn10-Jun-10 10:55
sitebuilderLuc Pattyn10-Jun-10 10:55 
GeneralRe: Can I pass binary data of a file to WebBrowser control? Pin
Hristo-Bojilov10-Jun-10 11:11
Hristo-Bojilov10-Jun-10 11:11 
GeneralRe: Can I pass binary data of a file to WebBrowser control? Pin
Luc Pattyn10-Jun-10 14:30
sitebuilderLuc Pattyn10-Jun-10 14:30 
AnswerRe: Can I pass binary data of a file to WebBrowser control? Pin
Luc Pattyn10-Jun-10 8:19
sitebuilderLuc Pattyn10-Jun-10 8:19 
GeneralRe: Can I pass binary data of a file to WebBrowser control? Pin
AspDotNetDev10-Jun-10 13:52
protectorAspDotNetDev10-Jun-10 13:52 
GeneralRe: Can I pass binary data of a file to WebBrowser control? Pin
Luc Pattyn10-Jun-10 14:46
sitebuilderLuc Pattyn10-Jun-10 14:46 
Thanks for your effort, however it did not change my view on things, so maybe I misunderstood both of you now, or, well, I don't know. I'll try to summarize the main facts so far:

1.
I understood the OP wants to see local data (images, PDF, whatever) which is stored in a database rather than in individual files, and wants to avoid the use of temporary files. I take it all he wants to see is one data object at a time, not a composition of some HTML and one or more database data objects. I am assuming all data types are popular types known to web browsers. If not, special viewers would be required (e.g. a HEX viewer for unstructured, "meaningless", binary data.

2.
The Tip&Trick works fine on my system, which has Vista-32, IE7 as original browser, FF3 as default browser, and using a .NET 2.0 debug build. So I would be inclined to say images cause no fundamental problem, provided they use a format WebBrowser recognizes AND understands (such as GIF).

3.
I have no idea yet what could go wrong for you there. I tested the exact code as published inside a pre-existing WinForm application. So I have some questions for you:
(A) did you change the code at all?
(B) what are your system's characteristics?
(C) Knowing the WebBrowser's size is 500*500, how large is the "X"? I assume it is red?

4.
If the OP uses my T&T code and replaces my synthetic image by some data read from his database, images should work.

5.
Hristo Bojilov signaled PDF would not work that way, and indeed PDF seems more complicated; IE and FF successfully load and display a remote PDF (when typing an URL in the address bar), WebBrowser also successfully navigates to the same PDF file, but fails to recognize a PDF when simply feeding it in its DocumentStream. It then simply shows the bytes as text. Some research has led to two complex ways around it, one of them is an article here on CP; the basic idea is to help WebBrowser in recognizing PDF files and selecting the right way to handle them, and so it is not based on an EMBED or OBJECT tag, as they would require a file. I haven't tested these yet, I have more urgent matters right now.

6. "but only if the OP has access to a web server"
I once created an embedded web server; it basically is a class one adds to an existing project; it takes data and produces web pages (that part of course needs customization), available on localhost at some port number. Doing so enables any WinApp to make data available to a browser running on the same PC, possibly a WebBrowser within the same app. As it basically uses WebRequest/WebResponse classes, it can provide data as well as data type information, so that should suffice to deliver all popular data formats without requiring files. It is pretty complex though (ca.300 LOC), way too large for a Tip&Trick. I would have to test it again for images and PDFs, but it looks like one way to get it all solved.

7.
I also once did some PDF server/client work a few years back, alas all in PHP and based on a couple of PHP libraries, which means impossible to port in a jiffy. I'd rather not go that route.

Conclusion:
- it is work in progress
- please correct me if you disagree with any of the above
- and please provide answers to the questions in (3), about the T&T not working for you.

Cheers.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]

I only read formatted code with indentation, so please use PRE tags for code snippets.

I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).

QuestionProblems setting vertical scrollbar value in a datagrid (old one, not the better DataGridView). Pin
NitzanJ9-Jun-10 23:56
NitzanJ9-Jun-10 23:56 
QuestionHOW TO Install SQLSERVER32 at installation Pin
MayukhSen9-Jun-10 23:54
MayukhSen9-Jun-10 23:54 
QuestionC# Polymorphic object comparison Pin
Benny_Lava9-Jun-10 23:37
Benny_Lava9-Jun-10 23:37 
AnswerRe: C# Polymorphic object comparison Pin
Łukasz Nowakowski9-Jun-10 23:41
Łukasz Nowakowski9-Jun-10 23:41 
GeneralRe: C# Polymorphic object comparison Pin
Benny_Lava10-Jun-10 0:55
Benny_Lava10-Jun-10 0:55 
AnswerRe: C# Polymorphic object comparison Pin
OriginalGriff9-Jun-10 23:47
mveOriginalGriff9-Jun-10 23:47 
GeneralRe: C# Polymorphic object comparison Pin
Łukasz Nowakowski10-Jun-10 0:31
Łukasz Nowakowski10-Jun-10 0:31 
GeneralRe: C# Polymorphic object comparison Pin
Benny_Lava10-Jun-10 0:57
Benny_Lava10-Jun-10 0:57 
AnswerRe: C# Polymorphic object comparison Pin
LookSharp11-Jun-10 13:13
LookSharp11-Jun-10 13:13 
Questioncrystal reports and c# (report directly with parameters). Pin
Absoluto9-Jun-10 22:10
Absoluto9-Jun-10 22:10 
AnswerRe: crystal reports and c# (report directly with parameters). Pin
Adam R Harris10-Jun-10 5:52
Adam R Harris10-Jun-10 5:52 
QuestionIntelliSense bug in VS2005 Pin
Mc_Topaz9-Jun-10 21:54
Mc_Topaz9-Jun-10 21:54 
AnswerRe: IntelliSense bug in VS2005 Pin
#realJSOP10-Jun-10 4:29
mve#realJSOP10-Jun-10 4:29 
GeneralRe: IntelliSense bug in VS2005 Pin
Mc_Topaz10-Jun-10 4:38
Mc_Topaz10-Jun-10 4:38 
GeneralRe: IntelliSense bug in VS2005 Pin
dybs12-Jun-10 10:19
dybs12-Jun-10 10:19 
Question.net framework 4 Pin
michaelgr19-Jun-10 20:46
michaelgr19-Jun-10 20:46 
AnswerRe: .net framework 4 Pin
Abhinav S9-Jun-10 21:01
Abhinav S9-Jun-10 21:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.