views:

450

answers:

0

I am creating an application in C# that is essentially automating a submission process. I am using an arraylist of web browser to make it multi threaded. The browser windows are never displayed they are just in memory, and from there i navigate them, and submit the form on the document completed etc. And for the most part it works fine.

The only problem is that after i submit the form, about 1/50 submissions, it breaks out into its own Internet Explorer window. And then continues to create 100's of tabs in that window all with the same URL. Which as far as i can see, is the page after submission. For one, i have absolutely no idea why it starts opening a million of them up, the submit only happens once and only once. So why it opens a million explorer windows i dont know. But the process is just a two page one. So it goes :

Submission page --> Submit --> submissionpage with #yoursubmission on the end of the URL.

As far as i can tell, i believe its the onsubmit making it break into its own window. Using either a new window call or target==_blank or something along those lines. Im just speechless right now after spending days working on this issue.

About the browser, it is a custom control that is just inheriting from the WebBrowser control so i can add some more "Variables" into the mix. Like how many loads it has done and when it should be destroyed and a few other things. I have overridden the OnNewWindow method within the browser to try and stop it opening a new browser but doesnt seem to work all too well. I also created an event handler within the application to stop it opening a new one but also cant get that to do it. Im assuming its grabbing it too late to stop anything, or the event is not being fired at all. A while back im sure i stuck in breakpoints and it didnt stop for anything, mind you i may have been too busy ctrl-alt-deleting to notice

Im not sure if there is someway i can stop it within the application or webbrowser control to not allow it to open new windows, or whether i can manipulate the HTML to not allow it to open a new window.

Anyone have any similar experiences or can help me.

P.S. Sorry if its not detailed enough. Only just started developing this year :).

Edit : Just as another note. Ive tried implementing the extended browser that is floating around the web that uses newwindow2. But doesnt seem to work :(. I create the event, point it to the sender as the ppdisp, but still opens a new one. And ive also tried using e.cancel AND creating a new webbrowser control and ppdisp at it. Just nothing can seem to suppress the windows.