# Process Bypass

Process bypass is a powerful capability that allows you to programmatically update the list of processes that can be excluded from the VPN tunnel. This feature enables certain applications to send their traffic outside the encrypted connection. It's particularly useful when you need to dynamically manage VPN exceptions based on specific application requirements or user scenarios.

{% hint style="success" %}
Additional info about common mistakes can be found on the page [Common issues](https://pango.gitbook.io/paas/sdk/unified-vpn-sdk-for-windows/features/other/common-issues).
{% endhint %}

## Updating Process Bypass

To update the process domain list programmatically, you can utilize the following:

{% hint style="info" %}
Using "ConfigureFirewallAsync" will create the necessary bypass rules only after the VPN tunnel is up. If you want to explicitly apply process bypass immediately after sending to the SDK - use "ConfigureBypassProcesses/ConfigureBypassProcessesAsync".
{% endhint %}

```csharp
var sdk = new SDK();

var request = new FirewallRequest
{
    UpdateBypassProcesses = new UpdateBypassProcessesRequest
    {
        Processes = new List<string>
        {
            "C:\\Program Files\\YourCompany\\YourCompanyApp.exe", // <-- Custom company application
            "C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe", // <-- Built-in Microsoft Edge browser
        },
    },
};

var result = await sdk.ConfigureFirewallAsync(request).ConfigureAwait(false);
Console.WriteLine(result.UpdateBypassProcesses);
// Message: "Ok"
// Result: Ok
```

`C:\\Program Files\\YourCompany\\YourCompanyApp.exe`: This could represent a custom application developed by your company. By adding this process to the bypass list, the application enables to send the traffic outside the encrypted connection.

`C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe`: This is the path to the built-in Microsoft Edge browser executable. Including Microsoft Edge in the bypass list enables to send the traffic outside the encrypted connection.

{% hint style="info" %}
In the code snippet, the backslashes (`\`) in the file paths are escaped using an additional backslash. This is necessary because the backslash is a special character in C# string literals. Forgetting to escape the backslashes is a common oversight and can lead to incorrect file paths.
{% endhint %}

{% hint style="warning" %}
Process Bypass requires the full path to the process file.
{% endhint %}

## Explicitly Updating Process Bypass

```csharp
var sdk = new SDK();
var request = new BypassProcessesRequest()
{
    UpdateBypassProcesses = new()
    {
        Processes = new List<string>
        {
            "C:\\Program Files\\YourCompany\\YourCompanyApp.exe", // <-- Custom company application
            "C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe", // <-- Built-in Microsoft Edge browser
        },
    },
};

var result = await sdk.ConfigureBypassProcessesAsync(request).ConfigureAwait(false);
Console.WriteLine(result.UpdateBypassProcesses);
// Message: "Ok"
// Result: Ok
```
