When using the Nscrape.ScrapePage action with a public Google-service URL (e.g., a public Google Doc), the following error occurs:
"An error was raised by the application: The 'Path'='/document/d/1zbJs...' part of the cookie is invalid."
Based on a review of the C# code, the issue appears to originate in WebClient.NScrapeUtility.ParseSetCookieHeader, which is read-only. It doesn't seem like much can be done within development control to resolve this directly.
I'm wondering if there are any workarounds or ways to intercept and prevent setting problematic cookies. There is an AddingCookie event available, but it only allows interaction—not a way to block the setting of invalid cookies. Is there a method to have SendRequest ignore certain cookies or handle this differently?
Hi,
The error likely stems from the NScrape library attempting to process a cookie with an invalid path, which can happen with some public Google URLs. Since ParseSetCookieHeader is internal and AddingCookie doesn’t allow filtering, a workaround could be to pre-process the response headers or use a custom CookieContainer to filter out problematic entries before NScrape handles them.
Alternatively, using a lower-level HTTP client to fetch the content, then passing the HTML to NScrape.ScrapePageHtml, might help avoid the cookie issue altogether.
Happy to dig deeper if needed!