How can i set the Windows Forms webbrowser control to block or allow cookies for the site it will navigate?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can implement a Custom Security Manager and return URLPOLICY_DISALLOW in pPolicy for each kind of action between URLACTION_NETWORK_MIN and URLACTION_NETWORK_MAX. There are several actions for cookies. For a list of cookie related actions, check your zone security settings in IE options.
There are multiple webbrowser controls in .Net. The WPF one isn’t customizable for this task. The Windows Forms one is kinda customizable however its IDocHostUIhandler implementation is stuck in internal code due to security guidelines of .Net BCL. You would be much better off if you use the raw ActiveX or its wrappers that support this kind of customization, e.g. csexwb. If you have to use the winform webbrowser control, you need to create your own webbrowser site.