C# and AxWebBrowser

Hello,

I am using AxWebBrowser to access web pages from within my application.  I have two problems facing me off at the moment.

1.  Is there a method to intercept a 404 response prior to redirection (if any)?
2.  If the URL specified to the AxWebBrowser includes a filedownload of any description, how do I intercept this? (I don't want to enable this!)

Is it me, or is there not a great deal of documentation on the AxWebBrowser?!

I'd appreciate any help that can be offered.

Thanks
Si-cloneAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

buraksaricaCommented:
1st answer : use NavigateError event of axWebBrowser as shown below. (i assume that there is a label on the form named label1)

private void axWebBrowser1_NavigateError(object sender, AxSHDocVw.DWebBrowserEvents2_NavigateErrorEvent e)
{
      if ((int)e.statusCode == 404)
      {
            label1.Text="not found";                        
      }
}

2nd answer : Try to use FileDownload of Web Browser control. There is an event argument class named e. This class has a property named cancel. Set cancel property to true. (Not tested)

Hope this helps.
Burak SARICA
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Si-cloneAuthor Commented:
Thanks for your reply.

I had previously tried the FileDownload event, but it didn't seem to fire.  However, on closer examination it appears that what I need to trap was a Java window offering to download a CAB file.  Maybe this is why the FileDownload event did not fire?!

One further question if I may :-)

Do you know the difference between events such as NewWindow2 and NewWindow3?

Thanks for your help.



0
buraksaricaCommented:
NewWindow is an event on older versions of internet explorer that raises when a new window is to be created. NewWindow2 is the newer version of this event. It uses the same arguments but it works better. Because of this MSDN says "NewWindow is obsolete, use NewWindow2 instead". The NewWindow3 extends the event NewWindow2 and it supplies you with more information about the newly created window such as URL of the page opening the new window and URL being opened etc.

Hope this helps.
Burak SARICA
0
Si-cloneAuthor Commented:
Thanks for your help
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.