# PathTransformExtensions Methods

- Package: [Aspire.Hosting.Yarp](/reference/api/csharp/aspire.hosting.yarp.md)
- Type: [PathTransformExtensions](/reference/api/csharp/aspire.hosting.yarp/pathtransformextensions.md)
- Kind: `Methods`
- Members: `4`

Extensions for adding path transforms.

## WithTransformPathPrefix(YarpRoute, PathString)

- Name: `WithTransformPathPrefix(YarpRoute, PathString)`
- Modifiers: `extension`
- Returns: [YarpRoute](/reference/api/csharp/aspire.hosting.yarp/yarproute.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Yarp/ConfigurationBuilder/Transforms/PathTransformExtensions.cs)

Adds the transform which will prefix the request path with the given value.

```csharp
public static class PathTransformExtensions
{
    public static YarpRoute WithTransformPathPrefix(
        this YarpRoute route,
        PathString prefix)
    {
        // ...
    }
}
```

## Parameters

- `route` ([YarpRoute](/reference/api/csharp/aspire.hosting.yarp/yarproute.md))
- `prefix` (`PathString`)

## Remarks

This overload is not available in polyglot app hosts. Use the string-based overload instead.

## ATS metadata

### Ignored by ATS

- Excluded from automatic Polyglot export.

## WithTransformPathRemovePrefix(YarpRoute, PathString)

- Name: `WithTransformPathRemovePrefix(YarpRoute, PathString)`
- Modifiers: `extension`
- Returns: [YarpRoute](/reference/api/csharp/aspire.hosting.yarp/yarproute.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Yarp/ConfigurationBuilder/Transforms/PathTransformExtensions.cs)

Adds the transform which will remove the matching prefix from the request path.

```csharp
public static class PathTransformExtensions
{
    public static YarpRoute WithTransformPathRemovePrefix(
        this YarpRoute route,
        PathString prefix)
    {
        // ...
    }
}
```

## Parameters

- `route` ([YarpRoute](/reference/api/csharp/aspire.hosting.yarp/yarproute.md))
- `prefix` (`PathString`)

## Remarks

This overload is not available in polyglot app hosts. Use the string-based overload instead.

## ATS metadata

### Ignored by ATS

- Excluded from automatic Polyglot export.

## WithTransformPathRouteValues(YarpRoute, PathString)

- Name: `WithTransformPathRouteValues(YarpRoute, PathString)`
- Modifiers: `extension`
- Returns: [YarpRoute](/reference/api/csharp/aspire.hosting.yarp/yarproute.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Yarp/ConfigurationBuilder/Transforms/PathTransformExtensions.cs)

Adds the transform which will set the request path with the given value.

```csharp
public static class PathTransformExtensions
{
    public static YarpRoute WithTransformPathRouteValues(
        this YarpRoute route,
        PathString pattern)
    {
        // ...
    }
}
```

## Parameters

- `route` ([YarpRoute](/reference/api/csharp/aspire.hosting.yarp/yarproute.md))
- `pattern` (`PathString`)

## Remarks

This overload is not available in polyglot app hosts. Use the string-based overload instead.

## ATS metadata

### Ignored by ATS

- Excluded from automatic Polyglot export.

## WithTransformPathSet(YarpRoute, PathString)

- Name: `WithTransformPathSet(YarpRoute, PathString)`
- Modifiers: `extension`
- Returns: [YarpRoute](/reference/api/csharp/aspire.hosting.yarp/yarproute.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Yarp/ConfigurationBuilder/Transforms/PathTransformExtensions.cs)

Adds the transform which sets the request path with the given value.

```csharp
public static class PathTransformExtensions
{
    public static YarpRoute WithTransformPathSet(
        this YarpRoute route,
        PathString path)
    {
        // ...
    }
}
```

## Parameters

- `route` ([YarpRoute](/reference/api/csharp/aspire.hosting.yarp/yarproute.md))
- `path` (`PathString`)

## Remarks

This overload is not available in polyglot app hosts. Use the string-based overload instead.

## ATS metadata

### Ignored by ATS

- Excluded from automatic Polyglot export.
