WebView2 exposes proxy authentication through BasicAuthenticationRequested. Register the handler after CoreWebView2 initialization and before starting the navigation that needs the proxy.

webView.CoreWebView2.BasicAuthenticationRequested += (_, e) =>
{
    if (!Uri.TryCreate(e.Uri, UriKind.Absolute, out var challengeUri)
        || !challengeUri.Host.Equals(proxyHost,
            StringComparison.OrdinalIgnoreCase)
        || challengeUri.Port != proxyPort)
    {
        return;
    }

    e.Response.UserName = proxyUser;
    e.Response.Password = proxyPassword;
};

The application supplies the configured proxyHost, proxyPort and account values. For a proxy challenge, the event’s Uri is the proxy server’s URI. Check the expected endpoint before selecting that account.

The same event can also represent website authentication. An unconditional handler that fills in a corporate proxy password for every event can send it to a website asking for its own login.

Select the proxy endpoint through the environment’s proxy configuration separately. The event answers a challenge; it does not choose the network route. If the application declines authentication, it can set e.Cancel. Leaving credentials unset otherwise allows WebView2’s default challenge dialog.

Аффингæй хæстæг статьялтæ