SimpleBrowserDotNet / SimpleBrowser

A flexible and intuitive web browser engine designed for automation tasks. Built on .NET Standard 2.1.
Other
362 stars 105 forks source link

SimpleBrowser contains IIS-specific code #253

Open kevingy opened 4 years ago

kevingy commented 4 years ago

In AnchorElement.Click() there is code that injects a hidden input for an IIS __EventTarget. (I think I was the who added it, years ago.) This addition was short-sighted. SimpleBrowser shouldn't care what the webserver is. If the code in question is needed, the SimpleBrowser consumer should implement it in their solution rather than to have this hack for IIS executed for every SimpleBrowser user regardless of problem space and webserver.

kevingy commented 4 years ago

Just so that it's understood, this code was also an attempt to support ASP.NET postbacks using JavaScript in a browser that doesn't support JavaScript. The EventTarget is pushed to the server in a page-round trip and intercepted in the PageLoad event on the ASP.NET WebForms page.

If the SimpleBrowser user changes the user-agent to something more common (Google, Firefox, IE), then IIS (which is where ASP.NET WebForms pages are typically hosted) will send the hidden __EVENTTARGET form input.

Honestly, I'm a bit torn whether or not to remove this code:

If there are any other opinions here, I'm open.