如何在WebBrowser控件中启用inPrivate模式

我必须在IE浏览器上添加一些额外的function。

在Visual Studio中,我们有一个名为“WebBrowser”的组件,它使用安装在用户PC中的当前IE浏览器。

但是,我无法找到任何能够访问我希望通过控件公开的InPrivate模式的属性。

有没有办法使用InPrivate模式与WebBrowser控件,或者我必须使自己的浏览器支持这个?

根据EricLaw对相关问题 的回答 ,听起来这可能是不可能的。

你可能会被困在自己的控制或寻找替代的控制。

这里有一些代码可以让您访问InPrivate IE

Friend Function Open(Optional ByVal Url As String = "about:blank", Optional ByVal WindowState As ProcessWindowStyle = ProcessWindowStyle.Hidden) As WebBrowser On Error Resume Next Dim Start As New ProcessStartInfo Dim Windows = New ShellWindowsClass Dim Count = Windows.Count Start.FileName = "iexplore.exe" Start.Arguments = "-private -nomerge " & Url If WindowState = ProcessWindowStyle.Hidden Then Start.WindowStyle = ProcessWindowStyle.Minimized Else Start.WindowStyle = WindowState End If Process.Start(Start) 'Wait is my own class that waits for 10 secs Wait.Reset() Do If Windows.Count > Count Then Exit Do Loop While Wait.Waiting Browser = Windows(Count) Browser.Visible = (WindowState <> ProcessWindowStyle.Hidden) Return Browser End Function