System.Windows.Forms.WebBrowser control not working on one page, but if it opens a new window, the new window works just fine.

  • Thread starter Thread starter Brian Tkatch
  • Start date Start date
B

Brian Tkatch

Guest
I am using a WebBrowser control (set to be IE11 in the registry) to login in a secure website to automate reports downloading. The browser will login and go to the report setup page, but when i click the button, whether manually or via invoke(), it opens up a new window which gives me a rights issue.

At this point (when running the code) i have two windows available to me: The browser on the form, and the new browser window that opened without a form. The browser on the form is missing the control bar, whereas the new window has everything a regular IE11 browser has.

The browser on the form will not display the report even if i click everything manually. The browser without the form works just fine once i login manually, even when i paste the data directly from the code (url, username, password, report url) and only click the final button (the one invoked in the code). This leads me to believe something is different between the two browser windows. I would like to determine what that is, and if possible, how to address the issue.

The reason a new window is opened is that the button runs some javascript that opens the final url with target set to _blank. In the browser in the form, this causes a new window to open (and display a rights error). In the browser without the form, it opens up a new tab instead, which closes as the report is downloaded.

I have been working on using httpclient to do the same task, and i have discovered that the report page will give me rights issues when some form elements are missing. Fwiw, when i get everything set, the server closes the connection unexpectedly, whether i use await or not. Being i do not have access to the server logs, (and i have tried a few solutions i found online) i figure its time to try the browser route again, because it should always have the correct data to be passed.

What could the difference be between these two broswer windows?

Continue reading...
 
Back
Top