Hi everyone.
I have a problem.
A web worker created by the main backgroung script
does not include session cookies during a GET XMLHTTP request
to an
ASP.NET page on an external server (server out of my control).
The responde I get is the login page when I would have expected another post-authentication page.
The request made by the main background script works,
whereas the same request made by the web worker (created by the background script) no anymore.
The same code magically returns to work using an older portable version of Iron browser (chromium).
From the developer console I verified that the session cookies are set like this: SameSite: <unset-blank> and Secure
I tried to turn the Web Worker into a Service Worker but the result doesn't change.
I tried to repeat the whole authentication process from the web worker, but to do this I have to iterate exactly what the user would do manually
that is:
1 call the login page
2 save the viewstate and other form hidden fields which will be sent with submit
3 build an url encoded string ready for send command (which obviously includes user and password field)
4 save back the viewstate and the same hidden fields of the form for any subsequent requests.
Here, however, another problem arises.
To retrieve and then save these hidden form fields, I have to parse the response with something like DOMParser
Pity that DOMParser inside the workers doesn't work!
How can I solve this problem?
The web worker job consists to call the same URL about 30 times but with different querystring parameters.
I execute these request one by one and in a strict order with a random delay between 3 and 10 seconds (I implement the delay with SetTimeout)
The response got from each request is a very simple HTML document with a TABLE that I parse (unfortunately without tools that come to my aid such as DOMParser) by hand with regular expression, trim and split, etc
Maybe it's much simpler than you think ...
Thanks for any suggestion