0

I have the following C# code to initialize and to use a proxy server with Microsoft Edge WebView2 control (v.1.0.3179.45):

var proxyAddress = ...
var proxyPort = ...
var proxyUserName = ...
var proxyPassword = ...
...
var options = new CoreWebView2EnvironmentOptions()
{
    AdditionalBrowserArguments = $"--proxy-server=http://{proxyAddress}:{proxyPort}",                            
};

var env = await CoreWebView2Environment.CreateAsync(null, null, options);
await _webView.EnsureCoreWebView2Async(env);

_webView.CoreWebView2.BasicAuthenticationRequested += async (sender, args) =>
{
    args.Response.UserName = proxyUserName;
    args.Response.Password = proxyPassword;
    await Task.CompletedTask;
};

It works well, but before calling BasicAuthenticationRequested inline event proc it calls NavigationCompleted event proc with WebErrorStatus equal to CoreWebView2WebErrorStatus.ValidProxyAuthenticationRequired (Http Status Code: 407).

Is there any other way to initialize Microsoft Edge WebView2 control to use a proxy server avoiding getting a call to the NavigationCompleted event proc with WebErrorStatus equal to CoreWebView2WebErrorStatus.ValidProxyAuthenticationRequired?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.