# LogtoConnectionStringHelper Methods

- Package: [CommunityToolkit.Aspire.Logto.Client](/reference/api/csharp/communitytoolkit.aspire.logto.client.md)
- Type: [LogtoConnectionStringHelper](/reference/api/csharp/communitytoolkit.aspire.logto.client/logtoconnectionstringhelper.md)
- Kind: `Methods`
- Members: `1`

Provides utility methods for extracting and validating endpoint information from connection strings in various formats. This helper is specifically designed to assist with parsing connection strings for use with the Logto client configuration.

<a id="getendpointfromconnectionstring"></a>
<a id="getendpointfromconnectionstring-string"></a>

## GetEndpointFromConnectionString(string?)

- Name: `GetEndpointFromConnectionString(string?)`
- Modifiers: `static` `nullable`
- Returns: `string?`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/d479e13473b1d29d06b974f144a0049289a3cb5c/src/CommunityToolkit.Aspire.Logto.Client/LogtoConnectionStringHelper.cs#L26-L54)

Retrieves the endpoint value from a given connection string. If the connection string is a valid URI, the method returns the URI as a string. If the connection string is in a key-value pair format, it extracts the value of the "Endpoint" key if present and validates it as a URI.

```csharp
public static class LogtoConnectionStringHelper
{
    public static string? GetEndpointFromConnectionString(
        string? connectionString)
    {
        // ...
    }
}
```

## Parameters

- `connectionString` (`string?`)
  The connection string to parse for an endpoint.

## Returns

`string?` -- A string representation of the endpoint if found and valid; otherwise, null if the connection string is null, empty, or does not contain a valid endpoint.
