# OpcClient.ChangeUserIdentity Method

> Reference: Changes the identity of the connected session to the identity specified without creating a new session (OPC 10000-4, ActivateSession).

<dl class="api-definition">
<dt>Type</dt>
<dd><a href="./">OpcClient</a></dd>
<dt>Namespace</dt>
<dd><a href="../namespaces/opc.uafx.client">Opc.UaFx.Client</a></dd>
<dt>Assembly</dt>
<dd>Opc.UaFx.Advanced.dll</dd>
<dt>Package</dt>
<dd>Opc.UaFx.Advanced v2.59.0</dd>
<dt>Members</dt>
<dd><a href="./members">OpcClient Members</a></dd>
<dt>Also in</dt>
<dd>Opc.UaFx.Client</dd>
</dl>

<span class="api-meta">since v2.58</span>

Changes the identity of the connected session to the `identity` specified without creating a new session (OPC 10000-4, ActivateSession).

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

```csharp
public void ChangeUserIdentity(OpcUserIdentity identity)
```

</div>

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

```vbnet
Public Sub ChangeUserIdentity(identity As OpcUserIdentity)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `identity` | [OpcUserIdentity](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcuseridentity/) | The [OpcUserIdentity](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcuseridentity/) to use from now on or a null reference (Nothing in Visual Basic) to continue as an anonymous user. |

**Exceptions**

| Exception | Condition |
|---|---|
| [InvalidOperationException](https://learn.microsoft.com/dotnet/api/system.invalidoperationexception) | The method is currently not supported, because of the license has expired. |
| [ObjectDisposedException](https://learn.microsoft.com/dotnet/api/system.objectdisposedexception) | The object has been disposed of. |
| [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) | The client is not connected ([BadServerNotConnected](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/#badservernotconnected)) or the server rejected the `identity`, for example with [BadUserAccessDenied](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/#baduseraccessdenied) or [BadIdentityTokenRejected](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/#badidentitytokenrejected). |

**Remarks**

On success the `identity` is also applied to the [UserIdentity](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.client.opcclientsecurity/members#useridentity), so a later reconnect uses it too. If the server rejects the `identity`, the [UserIdentity](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.client.opcclientsecurity/members#useridentity) remains unchanged.
