CoreWebView2Profile.ClearCustomDataPartitionAsync(String) Method

Definition

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Clears all DOM storage and cookies in the specified custom data partition.

C#
public System.Threading.Tasks.Task ClearCustomDataPartitionAsync (string CustomDataPartitionId);

Parameters

CustomDataPartitionId
String

The id of the custom data partition. If null or empty string is specified, ArgumentException will be thrown.

Returns

Examples

C#
var dialog = new TextInputDialog(
    title: "Clear Custom Data Partition",
    description: "Enter Custom Data Partition Id to clear",
    defaultInput: _iWebView2.CoreWebView2.CustomDataPartitionId);
if (dialog.ShowDialog() == true)
{
    try
    {
        await WebViewProfile.ClearCustomDataPartitionAsync(dialog.Input.Text);
        MessageBox.Show(this,
           "Completed",
           "Clear Custom Data Partition");
    }
    catch (Exception exception)
    {
        MessageBox.Show(this, "ClearCustomDataPartitionAsync Failed: " + exception.Message, "Clear Custom Data Partition");
    }
}

Remarks

Clears all DOM storage and cookies in the custom data partition identified by the CustomDataPartitionId. If no partition is found for the specified CustomDataPartitionId, the API succeeds without doing anything.

As DOM storage and cookies in the custom data partition is also browsing data, they will also be cleared when ClearBrowsingDataAsync(CoreWebView2BrowsingDataKinds) is called and the clearing condition is met.

Applies to

Proizvod Verzije
WebView2 .NET Prerelease 1.0.1724, 1.0.1777, 1.0.1829, 1.0.1905, 1.0.1988, 1.0.2065, 1.0.2106, 1.0.2164, 1.0.2194, 1.0.2357, 1.0.2415, 1.0.2470, 1.0.2526, 1.0.2584, 1.0.2646, 1.0.2730, 1.0.2783, 1.0.2839, 1.0.2895, 1.0.2950, 1.0.3079, 1.0.3116