Use the initialized request context serving the intended browser:

using System;
using CefSharp;

var result = await requestContext.SetProxyAsync(
    "http", "proxy.example", 8080);
if (!result.Success)
{
    throw new InvalidOperationException(result.ErrorMessage);
}

Await the operation and handle failure before navigation. For a permitted public-site check, the HTTP proxy list supplies candidates for the HTTP host and port arguments. SetProxyAsync schedules the preference update on the CEF UI thread and selects fixed_servers.

If the result reports the preference read-only, inspect command-line proxy flags; they can prevent this update. Awaiting alone does not turn a rejected change into an applied route.

A direct SetPreference call still needs CEF's UI thread. Under the usual multithreaded message-loop setup, the host application's WinForms or WPF UI thread is a different context.

Browsers sharing the request context share the preference. This selects the endpoint; a separate authentication callback must restrict credentials to its intended proxy challenge.

Allakkat attuumassuteqartut