# OpcRequestValidatingEventArgs Members

> Reference: Provides the event data for the RequestValidating event.

<dl class="api-definition">
<dt>Type</dt>
<dd><a href="./">OpcRequestValidatingEventArgs</a></dd>
<dt>Namespace</dt>
<dd><a href="../namespaces/opc.uafx.server">Opc.UaFx.Server</a></dd>
<dt>Assembly</dt>
<dd>Opc.UaFx.Advanced.dll</dd>
<dt>Package</dt>
<dd>Opc.UaFx.Advanced v2.59.0</dd>
</dl>

Inherits members from [EventArgs](https://learn.microsoft.com/dotnet/api/system.eventargs).

## Constructors

### OpcRequestValidatingEventArgs

Initializes a new instance of the [OpcRequestValidatingEventArgs](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.server.opcrequestvalidatingeventargs/) class using the `context`, `request`, `requestType` and `result` specified.

<div class="api-signature" data-lang="csharp">

```csharp
public OpcRequestValidatingEventArgs(
    OpcContext context,
    IOpcServiceRequest request,
    OpcRequestType requestType,
    OpcResult result)
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Sub New(
    context As OpcContext,
    request As IOpcServiceRequest,
    requestType As OpcRequestType,
    result As OpcResult)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `context` | [OpcContext](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccontext/) | The [OpcContext](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccontext/) of the request. |
| `request` | [IOpcServiceRequest](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.iopcservicerequest/) | The [IOpcServiceRequest](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.iopcservicerequest/) to validate. |
| `requestType` | [OpcRequestType](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.server.opcrequesttype/) | The [OpcRequestType](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.server.opcrequesttype/) of the `request`. |
| `result` | [OpcResult](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcresult/) | The [OpcResult](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcresult/) of the validation so far. |

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception) | The `context`, `request` or `result` is a null reference (Nothing in Visual Basic). |

**Remarks**

The [Cancel](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.server.opcrequestvalidatingeventargs/members#cancel) property is initialized to true if the `result` is bad.

## Properties

### Cancel

Gets or sets a value indicating whether the request is rejected.

<div class="api-signature" data-lang="csharp">

```csharp
public bool Cancel { get; set; }
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Property Cancel As Boolean
```

</div>

**Property value**

[Boolean](https://learn.microsoft.com/dotnet/api/system.boolean)

The value true to reject the request; otherwise the value false. The initial value is true if the [Result](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.server.opcrequestvalidatingeventargs/members#result) is bad.

**Remarks**

The server evaluates only the [Result](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.server.opcrequestvalidatingeventargs/members#result). Setting the value true while the [Result](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.server.opcrequestvalidatingeventargs/members#result) is good sets the [Result](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.server.opcrequestvalidatingeventargs/members#result) to [BadNotSupported](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/#badnotsupported). Setting the value false does not change the [Result](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.server.opcrequestvalidatingeventargs/members#result), so that a request whose [Result](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.server.opcrequestvalidatingeventargs/members#result) is bad is still rejected.

### Context

Gets the context of the request.

<div class="api-signature" data-lang="csharp">

```csharp
public OpcContext Context { get; }
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public ReadOnly Property Context As OpcContext
```

</div>

**Property value**

[OpcContext](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccontext/)

The [OpcContext](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccontext/) of the request, an [OpcOperationContext](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.server.opcoperationcontext/).

### Request

Gets the request to validate.

<div class="api-signature" data-lang="csharp">

```csharp
public IOpcServiceRequest Request { get; }
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public ReadOnly Property Request As IOpcServiceRequest
```

</div>

**Property value**

[IOpcServiceRequest](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.iopcservicerequest/)

The [IOpcServiceRequest](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.iopcservicerequest/) received by the server.

### RequestType

Gets the type of the request.

<div class="api-signature" data-lang="csharp">

```csharp
public OpcRequestType RequestType { get; }
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public ReadOnly Property RequestType As OpcRequestType
```

</div>

**Property value**

[OpcRequestType](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.server.opcrequesttype/)

One of the members defined by the [OpcRequestType](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.server.opcrequesttype/) enumeration.

### Result

Gets or sets the result of the validation.

<div class="api-signature" data-lang="csharp">

```csharp
public OpcResult Result { get; set; }
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Property Result As OpcResult
```

</div>

**Property value**

[OpcResult](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcresult/)

The [OpcResult](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcresult/) with which the server accepts the request if it is good or rejects the request if it is bad. Initially it is the result of the validation by the server, i.e. of the session, the authentication of the user and the access control.

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception) | The value is a null reference (Nothing in Visual Basic). |

**Remarks**

Setting a bad result sets [Cancel](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.server.opcrequestvalidatingeventargs/members#cancel) to true. If an event handler throws an [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/), the server rejects the request with its result; if it throws another exception, with the code [Bad](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/#bad).
