This is a very strange problem I came across and it's a show stopper for my current app. It happens all the time on the site I'm trying to interact with and it occasionally happens on google.com (or any site I'd imagine).

I'm trying to run a series of events depending on what URL is currently being navigated.

In my WebBrowser's DocumentCompleted event I have a switch which runs a different set of methods based on the URL.

After a document is complete, it'll run the switch fine but it runs what's inside of the case I'm trying to detect more than once. It's easy to see by placing a messagebox output. It'll come up 2 times instead of once.

I tried other ways of determining which page I'm currently on. Like using the DocumentTitleChanged event instead of DocumentCompleted, but I think DocumentCompleted is safer because it won't do anything until the document is loaded. Either way, the problem exists with DocumentTitleChanged too.

Any ideas? Btw I excluded the site where it occurs all the time because it requires a login and unfortunately I can't share it publicly. If you want to do a test, just throw together an app really quick and drop a messagebox into the DocumentChanged event, then have a textbox where you can enter different addresses -- it's bound to come up.