Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/260.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在WebBrowser控件中启用inPrivate模式_C#_Winforms_Web Applications_Webbrowser Control - Fatal编程技术网

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

C# 如何在WebBrowser控件中启用inPrivate模式,c#,winforms,web-applications,webbrowser-control,C#,Winforms,Web Applications,Webbrowser Control,我必须做一个IE类型的浏览器,上面有一些额外的功能 在VisualStudio中,我们有一个名为“WebBrowser”的组件,它使用安装在用户pc中的当前IE浏览器 但是,我找不到任何允许访问InPrivate模式的属性,我希望控件能够公开该模式 有没有办法将InPrivate模式与WebBrowser控件一起使用,或者我必须制作自己的浏览器来支持这一点?根据a的说法,这似乎是不可能的 您可能会在制作自己的控件或寻找其他控件时遇到困难。根据a的说法,这似乎是不可能的 您可能会在创建自己的控件或

我必须做一个IE类型的浏览器,上面有一些额外的功能

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

但是,我找不到任何允许访问InPrivate模式的属性,我希望控件能够公开该模式


有没有办法将InPrivate模式与WebBrowser控件一起使用,或者我必须制作自己的浏览器来支持这一点?

根据a的说法,这似乎是不可能的

您可能会在制作自己的控件或寻找其他控件时遇到困难。

根据a的说法,这似乎是不可能的


您可能会在创建自己的控件或寻找替代控件时遇到困难。

以下是一些代码,可以让您访问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
Friend函数作为WebBrowser打开(可选ByVal Url为String=“about:blank”,可选ByVal WindowsState为ProcessWindowStyle=ProcessWindowStyle.Hidden)
出错时继续下一步
Dim启动为新流程StartInfo
Dim Windows=新的ShellWindowsClass
Dim Count=Windows.Count
Start.FileName=“iexplore.exe”
Start.Arguments=“-private-nomerge”&Url
如果WindowsState=ProcessWindowsStyle.Hidden,则
Start.WindowStyle=ProcessWindowStyle.Minimized
其他的
Start.WindowStyle=WindowState
如果结束
进程启动(启动)
“Wait是我自己的类,它等待10秒
等等,重置()
做
如果Windows.Count>Count,则退出Do
等待时循环。等待
浏览器=窗口(计数)
Browser.Visible=(WindowState ProcessWindowStyle.Hidden)
返回浏览器
端函数

以下是一些代码,可以让您访问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
Friend函数作为WebBrowser打开(可选ByVal Url为String=“about:blank”,可选ByVal WindowsState为ProcessWindowStyle=ProcessWindowStyle.Hidden)
出错时继续下一步
Dim启动为新流程StartInfo
Dim Windows=新的ShellWindowsClass
Dim Count=Windows.Count
Start.FileName=“iexplore.exe”
Start.Arguments=“-private-nomerge”&Url
如果WindowsState=ProcessWindowsStyle.Hidden,则
Start.WindowStyle=ProcessWindowStyle.Minimized
其他的
Start.WindowStyle=WindowState
如果结束
进程启动(启动)
“Wait是我自己的类,它等待10秒
等等,重置()
做
如果Windows.Count>Count,则退出Do
等待时循环。等待
浏览器=窗口(计数)
Browser.Visible=(WindowState ProcessWindowStyle.Hidden)
返回浏览器
端函数

您需要向我们提供有关该组件的更多信息,该组件由哪家公司生产?您是说这个吗?您好,谢谢您的快速回复。是的,我是说webbrowser嗯,我搜索了你对同一个问题的答案,发现没有这样的问题,然后我为每个webbrowser控件使用不同的窗口帐户提出了一个解决方案。你需要给我们更多关于这个组件的信息,它是什么公司生产的?你是说这个吗?嗨,谢谢你的快速回复。是的,我是说webbrowser嗯,我搜索了你对同一个问题的答案,发现没有这样的问题,然后我为每个webbrowser控件使用了不同的窗口帐户,找到了一个解决方案。关于InPrivate的好信息,但没有回答这个问题。OP需要Windows窗体WebBrowser控件使用此选项。“或者我必须制作自己的浏览器来支持此选项”您可以使用此函数的返回创建自己的浏览器。我假设任何想制作自己的浏览器的人都知道怎么做。我认为这是一个错误的假设。这可能只是一个被告知他想制作自己的浏览器的人。这不是一个假设,而是一个问题——你没有更好的事情要做吗?InPrivate上的好信息,但没有回答这个问题。OP需要Windows窗体WebBrowser控件使用此选项。“或者我必须制作自己的浏览器来支持此选项”您可以使用此函数的返回创建自己的浏览器。我假设任何想制作自己的浏览器的人都知道怎么做。我认为这是一个错误的假设。这可能只是一个被告知他想制作自己的浏览器的人。这不是一个假设,而是一个问题——你没有更好的事情要做吗?