Back to Devexpress

ProcessStartPolicy.RestrictedProcessStartConfirmationEventArgs Class

corelibraries-devexpress-dot-data-dot-utils-dot-processstartpolicy-8ab379a6.md

latest3.6 KB
Original Source

ProcessStartPolicy.RestrictedProcessStartConfirmationEventArgs Class

Contains data for the ConfirmationRequest event.

Namespace : DevExpress.Data.Utils

Assembly : DevExpress.Data.Desktop.v25.2.dll

NuGet Packages : DevExpress.Data.Desktop, DevExpress.ExpressApp.Win.Design

Declaration

csharp
public class RestrictedProcessStartConfirmationEventArgs :
    EventArgs
vb
Public Class RestrictedProcessStartConfirmationEventArgs
    Inherits EventArgs

ProcessStartPolicy.RestrictedProcessStartConfirmationEventArgs is the data class for the following events:

Remarks

The RestrictedProcessStartConfirmationEventArgs class supplies detailed information about a process that is about to be started and is considered potentially unsafe under the active ProcessStartPolicy.

You can inspect the target executable, its command-line arguments, or the associated URI (if applicable), and explicitly allow or block execution by calling the AllowStart() or BlockStart() method.

The following example enables the RequireConfirmation() policy at application startup and handles the ConfirmationRequest event to implement custom validation logic. The event handler allows only HTTPS URLs and blocks all other process start requests without displaying the confirmation dialog.

csharp
using DevExpress.Data.Utils;

internal static class Program {
    [STAThread]
    static void Main() {
      // Apply the RequireConfirmation policy.
        ProcessStartPolicy.RequireConfirmation();

        ProcessStartPolicy.ConfirmationRequest += ProcessStartPolicy_ConfirmationRequest;

        ApplicationConfiguration.Initialize();
        Application.Run(new Form1());
    }

    // Allow only HTTPS URLs.
    static void ProcessStartPolicy_ConfirmationRequest(object? sender, ProcessStartPolicy.RestrictedProcessStartConfirmationEventArgs e) {
        if (e.Uri != null)
            if (e.Uri.Scheme == Uri.UriSchemeHttps)
                e.AllowStart(); // Safe URL — allow execution
            else
                e.BlockStart(); // Non-HTTPS — block execution
    }
}

Inheritance

Object EventArgs ProcessStartPolicy.RestrictedProcessStartConfirmationEventArgs

See Also

ProcessStartPolicy.RestrictedProcessStartConfirmationEventArgs Members

DevExpress.Data.Utils Namespace