title: Add a customized header to WebBrowser control for all requests in C++/CLI?
body: <p>I'm trying to reproduce this <a href="https://stackoverflow.com/a/49631828/8684836">C# workaround</a> in C++/CLI, but it doesn't work, here's my code:</p>
  
  <pre><code>private: System::Void WebBrowser1_Navigating(System::Object^ sender, System::Windows::Forms::WebBrowserNavigatingEventArgs^ e) {
      System::Diagnostics::Debug::WriteLine("Running...");
      auto activeXInstance = (SHDocVw::IWebBrowser2^) this-&gt;webBrowser1-&gt;GetType()-&gt;InvokeMember("ActiveXInstance", System::Reflection::BindingFlags::GetProperty | System::Reflection::BindingFlags::Instance | System::Reflection::BindingFlags::NonPublic, nullptr, this-&gt;webBrowser1, gcnew array&lt;System::Object^&gt;{});
      System::Diagnostics::Debug::WriteLine("I won't be printed.");
      auto setupEvents2 = (SHDocVw::DWebBrowserEvents2_Event^) activeXInstance;
      setupEvents2-&gt;BeforeNavigate2 += gcnew SHDocVw::DWebBrowserEvents2_BeforeNavigate2EventHandler(this, &amp;MyForm::OnBeforeNavigate2);
  }
  
  private: System::Void OnBeforeNavigate2(System::Object^ pDisp, System::Object^% URL, System::Object^% Flags, System::Object^% TargetFrameName, System::Object^% PostData, System::Object^% Headers, bool %Cancel) {
      Headers = "User-Agent:Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19";
  }
  </code></pre>
  
  <p>That method is executed however it stops at the first line, the next lines get capped and no exceptions are thrown.</p>