【问题标题】:How to provide Credentials in http Proxy in Dotnetbrowser?如何在 Dotnetbrowser 的 http 代理中提供凭据?
【发布时间】:2021-08-14 18:09:55
【问题描述】:

我在Dotnetbrowser 工作,使用没有凭据的代理。但我需要在代理中提供用户名和密码。我正在我的构造函数中实现code。这是我的工作代码

        string proxyRules = String.Format("http={0}:{1};https={0}:{1};ftp={0}:{1};socks={0}:{1}", hostName, port);

        string exceptions = "<local>";  // bypass proxy server for local web pages 

        engine.Proxy.Settings = new CustomProxySettings(proxyRules, exceptions);

我找到了代码,但由于代码不完整而无法实现

network.AuthenticateHandler = new Handler<AuthenticateParameters, AuthenticateResponse>(p =>
AuthenticateResponse.Continue("<username>", "<password>"));

当我将此代码粘贴到我的类中时,文档不完整,它给出了异常

The name 'network' does not exists in current context

请提供任何示例代码或链接。

【问题讨论】:

    标签: c# http-proxy dotnetbrowser proxy-authentication


    【解决方案1】:

    由于文档不完整,我遇到了这个问题,完整的代码如下:

    engine.Network.AuthenticateHandler = new Handler<AuthenticateParameters, AuthenticateResponse>(p => AuthenticateResponse.Continue(userName, password));
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-03-22
      • 2022-01-19
      • 2019-10-15
      • 1970-01-01
      相关资源
      最近更新 更多