WebBrowser control as an HTML document viewer?

D

David Veeneman

I'm writing an application that will manage a database of documents typed
into the application by the user. Some documents will contain links to other
documents. If the user clicks on a link, the application will get the linked
document from the database and display it. The .NET 2.0 WebBrowser control
looks like a good candidate to display the documents (document entry will by
done by a form with text boxes).

Here are my questions:

(1) Is the WebBrowser a good candidate for this role? Are there better
Windows Form controls readily available?

(2) Are there any good examples out there of how to code the links? From
MSDN, the best approach seems to be to store the record ID of the linked
document in the URI property, then trap the Navigating event and get the ID
from the event args. Are there better approaches?

Thanks in advance.

David Veeneman
Foresight Systems
 
N

Nicholas Paldino [.NET/C# MVP]

David,

I think that the WebBrowser control is a fine candidate.

The solution you offer is a good suggestion. As long as you are
consistent in how you shape your urls which you will ultimately intercept,
you should be fine.

However, I would recommend creating your own scheme (you can do this by
having an asynchronous pluggable protocol handler) and then handling the
processing in there. It is cleaner, and you won't have to write a whole lot
of junk code in order to get the links to work properly. As long as you
generate the HTML correctly and the links correctly, your pluggable protocol
handler will do the heavy lifting of getting (and possibly generating) the
content.

Of course, it will require a great amount of interop of you do this in
..NET, but I think it is the cleaner solution.

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top