|
Rank: Newbie Groups: Member
Joined: 1/10/2018 Posts: 8
|
I have tried removing cookies via the Request in methods like BeforeSendHeaders, but they still seem to be used in requests. Is there anyway to delete the cookies either all or individually.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,258
|
Hi,
Please use BeforeRequestLoad event instead. You can not modify the request in BeforeSendHeaders event handler, but you can do so in BeforeRequestLoad event handler.
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 1/10/2018 Posts: 8
|
Only trouble is that BeforeRequestLoad doesn't have any cookies in the collection for some reason, it is count = 0, but beforesendheaders does
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,258
|
Ah --- you are correct. In that case you won't be able to use it for your purpose. BeforeRequestLoad is triggered before the cookies in the cookie jar has been loaded. The only other way you can try is to use a custom resource handler: https://www.essentialobjects.com/doc/webbrowser/advanced/resource_handler.aspxThis way you will be taking over the resource loading layer completely. You will want to only intercept the requests you wish to modify though since the browser engine's resource loader is highly optimized and if you take over it completely for all resources it could have a significant negative impact on the performance.
|
|
Rank: Newbie Groups: Member
Joined: 1/10/2018 Posts: 8
|
Ok, so see how that will work, but is there any way I can add the base ProcessRequest, as I need to know what it normally does for normal requests.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,258
|
No. You can not modify it and pass it down streams. You either take over completely or do not touch it at all.
|
|
Rank: Advanced Member Groups: Member
Joined: 1/12/2015 Posts: 88
|
Is there any way to remove the cookies using Javascript?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,258
|
No. Not the one you are sending to the server.
|
|
Rank: Advanced Member Groups: Member
Joined: 1/12/2015 Posts: 88
|
I was able to clear the cookies by executing the Javascript listed here: https://stackoverflow.com/a/33366171However, I was wondering if I can do this type of cookie manipulation directly with .NET code.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,258
|
BenjaminSimpson1989 wrote:I was able to clear the cookies by executing the Javascript listed here: https://stackoverflow.com/a/33366171However, I was wondering if I can do this type of cookie manipulation directly with .NET code. Thanks for sharing. You can run any JavaScript code from .NET side with this function: https://www.essentialobjects.com/doc/eo.webbrowser.webview.evalscript_overloads.aspx
|
|
Rank: Advanced Member Groups: Member
Joined: 1/12/2015 Posts: 88
|
I'm already using that function to execute the Javascript. I was just wondering if I could manipulate the cookies in the browser directly through .NET instead.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,258
|
BenjaminSimpson1989 wrote:I'm already using that function to execute the Javascript. I was just wondering if I could manipulate the cookies in the browser directly through .NET instead. No. We do not have direct support for this yet.
|
|
Rank: Advanced Member Groups: Member
Joined: 1/12/2015 Posts: 88
|
Is there any plan to in the near future?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,258
|
We are looking into this. Will reply here again once we have more information.
|
|
Rank: Advanced Member Groups: Member
Joined: 1/12/2015 Posts: 88
|
It looks like you added support with the Cookie Manager
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,258
|
Yes. We did add this feature recently. Sorry for not having updated this thread.
|
|