473,326 Members | 2,113 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Intercepting navigation commands in AxWebBrowser control

I'm working on an application for browsing encrypted files (HTML and
PDF mostly)on a DVD. My plan is to decrypt the files to memory and
stream them to the AxWebBrowser component which should be able to
display them at that point. However, I haven't been able to find a way
to intercept the navigation command when someone clicks on a link in an
HTML page so I can pre-process the file before it is rendered.
From what I've been able to find, it looks like I may have to create a

wrapper for the AxWebBrowser that overrides the Navigate() function,
but I haven't found any good documentation on how to do that or what
the Navigate() function does exactly. I can handle the Navigate2()
function with the event handler that is part of the class, but that
doesn't help me when the user clicks on a link embedded in one of the
HTML pages.

Anyone have any suggestions?

Nov 17 '05 #1
6 2578
You will have to do much more than this, actually. You want to look
into Asynchronous Pluggable Protocols (APP). You will have to create
something which will handle a custom protocol that you define, and then
stream the appropriate data.

An APP is a COM object, and the interfaces are not defined in .NET which
you need to define, so you will have to do a good deal of interop.

You could also take the cheap way out, and basically decrypt the file to
a temp file on disk, and then delete it, but I imagine that is not a
feasable solution for you.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<ig*******@hunter.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
I'm working on an application for browsing encrypted files (HTML and
PDF mostly)on a DVD. My plan is to decrypt the files to memory and
stream them to the AxWebBrowser component which should be able to
display them at that point. However, I haven't been able to find a way
to intercept the navigation command when someone clicks on a link in an
HTML page so I can pre-process the file before it is rendered.
From what I've been able to find, it looks like I may have to create a

wrapper for the AxWebBrowser that overrides the Navigate() function,
but I haven't found any good documentation on how to do that or what
the Navigate() function does exactly. I can handle the Navigate2()
function with the event handler that is part of the class, but that
doesn't help me when the user clicks on a link embedded in one of the
HTML pages.

Anyone have any suggestions?

Nov 17 '05 #2
The cheap way out may be a feasible solution. The current 3rd party
app my company currently uses takes that approach, but I was hoping it
wouldn't be significantly more difficult to read/write the files
directly to/from memory to increase security.

The APPs look promising. I assume that they will work for file URIs as
well? Also, can I temporarily register the APP for my application
only, so that other instances of IE (not the AxWebBrowser component)
will not be affected, even if both are in use at the same time?

Nov 17 '05 #3
Yeah, that boldtbanan post is mine too, logged in with the wrong acct.

One more thing about APPs....do I have to include the protocol name
when calling the file? ...e.g. myprotocol:myfile ...The files I'm
using are an existing HTML dump of sections of our company website, so
I would have to modify every link tag in the HTML to include the
protocol reference if that's the case.

Thanks

Ian Garrison

Nov 17 '05 #4
The thing about APPs is that it is YOUR uri scheme. You arent going to
replace the HTTP scheme, you are going to create your own, and you are going
to feed the data to the calling architecture (which is COM). It doesn't
matter what the back end is to COM, you are responsible for it.

As for temporarily registering the protocol, you would have to get the
CoInternetGetSession function (it is a function that COM exposes) which gets
the IInternetSession interface implementation. On that, you would call the
RegisterNamespace method to register a particular implementation for a
particular scheme for the process.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<bo********@gmail.com> wrote in message
news:11*********************@o13g2000cwo.googlegro ups.com...
The cheap way out may be a feasible solution. The current 3rd party
app my company currently uses takes that approach, but I was hoping it
wouldn't be significantly more difficult to read/write the files
directly to/from memory to increase security.

The APPs look promising. I assume that they will work for file URIs as
well? Also, can I temporarily register the APP for my application
only, so that other instances of IE (not the AxWebBrowser component)
will not be affected, even if both are in use at the same time?

Nov 17 '05 #5
Ian,

If the references are absolute, then yes, you will have to change them.
However, if they are relative, then you shouldn't have to worry about it.
They should fix up normally.

The APP is very simple in a sense. It sees a scheme, it calls your
object to get it, passing you the url. You then return a stream to the
source (it's much more complicated than that, but that's a very high level
view).

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<ig*******@hunter.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Yeah, that boldtbanan post is mine too, logged in with the wrong acct.

One more thing about APPs....do I have to include the protocol name
when calling the file? ...e.g. myprotocol:myfile ...The files I'm
using are an existing HTML dump of sections of our company website, so
I would have to modify every link tag in the HTML to include the
protocol reference if that's the case.

Thanks

Ian Garrison

Nov 17 '05 #6
Nicholas,

The APP approach is looking good, and I think I've figured out how to
approach things from that angle, but I'm still shaky on how to
temporarily register an APP. I understand what you said previously
about getting the IInternetSession and using the RegisterNamespace
method, but I'm not sure how to access the objects through C#. I've
only been working with C# for about 2 months now, and haven't dealt
with Interop beyond using the VS2003 COM object importer, and from what
I've read, that isn't effective in this situation.

The most helpful example I've found is at

http://www.codeproject.com/aspnet/AspxProtocol.asp

and I'm piecing together the actual implementation of the APP from
that. (Actual examples are hard to come by, especially for temporarily
registering the APP. The Microsoft documentation helps with the idea
behind APPS, which I completely understand, but not one bit with the
implementation side). Can you point me somewhere that shows me what I
need to do to set up my app to register the namespace (preferable with
some code examples).

Thanks,

Ian

Nov 17 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Lecture Snoddddgrass | last post by:
Hi, I noticed that my WinForms app was taking a while to start up. I stepped through the code to find out which line was causing the delay. The delay is occurring within one of my UserControls...
4
by: TF | last post by:
hi, i am using AxWebBrowser control in my C# dot.net windows application. i want to display a web page in the browser that needs some data sent to it through HTML Form 'POST' method. I saw a...
1
by: SPG | last post by:
Hi, I have an app that requires several of the web controls to be shown in an MDI form. In most cases I can show these forms and point them all to different URLS fine. Every now and then,...
2
by: Mitch | last post by:
I am hosting a web browser ctl in a container that implements the IDocHostUIHandler interface. I'm using this to control the context menu.This works fine. Then, I added a mouseover event to the...
0
by: beau | last post by:
Hi, I'm using the AxWebBrowser in a C# WinForms application. I've got the basics working, but need some help controlling the view options for browsing files. How can I disable the...
3
by: Clint MacDonald | last post by:
I have used the AxWebBrowser in a Visual Basic Project... I found that both Framework 1.0 and 1.1 had to be installed for it to work properly. I now have found that in Studio 2003, that the...
3
by: Danny | last post by:
i am trying to load different pages and scanning some words out of the pages. But my problem is that the readystate is never 4 except when i show a msgbox example: ...
6
by: Dave Booker | last post by:
It appears that I cannot correctly install the AxWebBrowser in VS2005. I can instantiate an "AxWebBrowser browser" and refer to its members, properties, and methods. I'm having trouble with the...
0
by: John Phelan-Cummings | last post by:
In the process of polishing up my (last) beta application; I have been exploring all the possible ways of speeding up my forms. I realized that numerous a forms under various application...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.