title: How to use Proxy in PuppeteerSharp without using the system global proxy settings
body: <p>Due to some restrictions, I have to use a Proxy to visit one specific web site. To this end, I subscribe one paid proxy service, and tried to visit that web site, it worked. However, to use the proxy service by Google Chrome, I have to configure the proxy settings from Windows Edge browser, so the proxy settings affect all the web browsers in my PC, which I don’t want; because, except that specific web site, I can visit all other web sites directly using my ISP without any issue. I have tried the following C# code to see if I can visit “WhatIsMyIP” web site using proxy settings only during the underlying Chromium session.</p>
  
  <pre><code>    private static readonly LaunchOptions puppeteer_launchOptions = new LaunchOptions
  {
  Headless = false,
  IgnoreHTTPSErrors = true,
  Args = new[] {
  "--no-sandbox",
  "--disable-infobars",
  "--disable-setuid-sandbox",
  "--ignore-certificate-errors",
  $"--proxy-server='1.2.3.4:5678'",
  },
  };
  
  static async Task Main()
  {
  await new BrowserFetcher().DownloadAsync(BrowserFetcher.DefaultRevision);
  _browser = await Puppeteer.LaunchAsync(puppeteer_launchOptions);
  Page _page = await _browser.NewPageAsync();
  await _page.SetViewportAsync((new ViewPortOptions { Width = 1920, Height = 938 }));
  _page.DefaultNavigationTimeout = 100000;
  await _page.GoToAsync("https://www.whatismyip.com/");
  await _page.WaitForTimeoutAsync(2000);
  Console.WriteLine("My Public IP is:");
  }
  </code></pre>
  
  <p>However, my code did NOT work, I got error message: PuppeteerSharp.NavigationException HResult=0x80131500 Message=net::ERR_NO_SUPPORTED_PROXIES at <a href="https://www.whatismyip.com/" rel="nofollow noreferrer">https://www.whatismyip.com/</a> at <a href="https://www.whatismyip.com/" rel="nofollow noreferrer">https://www.whatismyip.com/</a> Source=PuppeteerSharp StackTrace: at PuppeteerSharp.FrameManager.d__42.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at ProxyWhatIsMyIP.Program.d__3.MoveNext() in C:\DualDataLiveBet\BetFairProxy\ProxyWhatIsMyIP\ProxyWhatIsMyIP\Program.cs:line 31</p>
  
  <p>Inner Exception 1: NavigationException: net::ERR_NO_SUPPORTED_PROXIES at <a href="https://www.whatismyip.com/" rel="nofollow noreferrer">https://www.whatismyip.com/</a></p>
  
  <p>But if I changed the global proxy settings in Microsoft Edge browser, and deleted the proxy settings in my C# code, it worked. The following was the working code:</p>
  
  <pre><code>    using PuppeteerSharp;
  using System; 
  using System.Threading.Tasks;
  namespace ProxyWhatIsMyIP 
  { 
  class Program 
  { 
  public static Browser _browser;
  private static readonly LaunchOptions puppeteer_launchOptions = new LaunchOptions
  {
      Headless = false,
      IgnoreHTTPSErrors = true,
      Args = new[] {
      "--no-sandbox",
      "--disable-infobars",
      "--disable-setuid-sandbox",
      "--ignore-certificate-errors",
      },
  };
  static async Task Main()
  {
      await new BrowserFetcher().DownloadAsync(BrowserFetcher.DefaultRevision);
      _browser = await Puppeteer.LaunchAsync(puppeteer_launchOptions);
      Page _page = await _browser.NewPageAsync();
      await _page.SetViewportAsync((new ViewPortOptions { Width = 1920, Height = 938 }));
      _page.DefaultNavigationTimeout = 100000;
      await _page.GoToAsync("https://www.whatismyip.com/");
      await _page.WaitForTimeoutAsync(2000);
      Console.WriteLine("My Public IP is:");
  }
  }
  </code></pre>
  
  <p>But it is not what I want. I only want to use Proxy during this Chromium session, but keep the global proxy settings untouched (not to use any proxy in my PC.) Please advice how I can do this? By the way, I am using Visual Studio 2019 Version 16.3.2 with PuppeteerSharp 1.20.0, targetting .NET Core 3.0. My PC is running on Windows 10 (Version 1903) with latest updates applied. Thanks,</p>