#### [Abblix\.Oidc\.Server\.Mvc](https://www.abblix.com/en/docs/api/abblix-oidc-server-mvc 'index')
### [Abblix\.Oidc\.Server\.Mvc\.ActionResults](https://www.abblix.com/en/docs/api/abblix-oidc-server-mvc/Abblix.Oidc.Server.Mvc.ActionResults 'Abblix\.Oidc\.Server\.Mvc\.ActionResults')

## ActionResultExtensions Class

Composable post\-processing helpers for [Microsoft\.AspNetCore\.Mvc\.ActionResult](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.actionresult 'Microsoft\.AspNetCore\.Mvc\.ActionResult') instances returned from OIDC controllers\.
Each extension wraps the original result so it still executes its own pipeline, while attaching headers,
cookies, or formatting OAuth errors as RFC\-compliant HTTP responses\.

```csharp
public static class ActionResultExtensions
```

Inheritance [System\.Object](https://learn.microsoft.com/en-us/dotnet/api/system.object 'System\.Object') → ActionResultExtensions
### Methods

## ActionResultExtensions\.Format\(this OidcError, int, string\) Method {#Abblix.Oidc.Server.Mvc.ActionResults.ActionResultExtensions.Format(thisAbblix.Oidc.Server.Common.OidcError,int,string)}

Formats an [OidcError](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Common.OidcError 'Abblix\.Oidc\.Server\.Common\.OidcError') as an appropriate HTTP error response per RFC 6750 Section 3\.
Bearer token errors \(`invalid_token`\) return HTTP 401 with only a `WWW-Authenticate` header
and no response body\. Scope errors \(`insufficient_scope`\) return HTTP 403 with the header\.
Client authentication failures \(`invalid_client`\) return HTTP 401 with a Basic challenge
and the JSON error body per RFC 6749 Section 5\.2\.
All other errors use the specified fallback status code with a JSON body\.

```csharp
public static Microsoft.AspNetCore.Mvc.ActionResult Format(this Abblix.Oidc.Server.Common.OidcError error, int fallbackStatusCode, string? realm=null);
```
#### Parameters

###### `error` [OidcError](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Common.OidcError 'Abblix\.Oidc\.Server\.Common\.OidcError') {#Abblix.Oidc.Server.Mvc.ActionResults.ActionResultExtensions.Format(thisAbblix.Oidc.Server.Common.OidcError,int,string).error}

The OIDC error to format\.

###### `fallbackStatusCode` [System\.Int32](https://learn.microsoft.com/en-us/dotnet/api/system.int32 'System\.Int32') {#Abblix.Oidc.Server.Mvc.ActionResults.ActionResultExtensions.Format(thisAbblix.Oidc.Server.Common.OidcError,int,string).fallbackStatusCode}

The HTTP status code to use for non\-token errors\.

###### `realm` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.Oidc.Server.Mvc.ActionResults.ActionResultExtensions.Format(thisAbblix.Oidc.Server.Common.OidcError,int,string).realm}

Optional realm value identifying the protection space \(typically the issuer URI\)\.

#### Returns
[Microsoft\.AspNetCore\.Mvc\.ActionResult](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.actionresult 'Microsoft\.AspNetCore\.Mvc\.ActionResult')  
An [Microsoft\.AspNetCore\.Mvc\.ActionResult](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.actionresult 'Microsoft\.AspNetCore\.Mvc\.ActionResult') with the appropriate status code and headers\.

## ActionResultExtensions\.Format\(this OidcError, int, string, IEnumerable\<string\>, bool\) Method {#Abblix.Oidc.Server.Mvc.ActionResults.ActionResultExtensions.Format(thisAbblix.Oidc.Server.Common.OidcError,int,string,System.Collections.Generic.IEnumerable_string_,bool)}

Formats an [OidcError](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Common.OidcError 'Abblix\.Oidc\.Server\.Common\.OidcError') as an HTTP error response that advertises the DPoP
scheme \(RFC 9449 §7\.1\) on the `WWW-Authenticate` header, optionally alongside the
Bearer scheme\. [UseDPoPNonceError](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Common.UseDPoPNonceError 'Abblix\.Oidc\.Server\.Common\.UseDPoPNonceError') additionally emits the `DPoP-Nonce`
response header so the client can echo the freshly issued nonce on retry\.

```csharp
public static Microsoft.AspNetCore.Mvc.ActionResult Format(this Abblix.Oidc.Server.Common.OidcError error, int fallbackStatusCode, string? realm, System.Collections.Generic.IEnumerable<string> dpopAlgs, bool advertiseBearer);
```
#### Parameters

###### `error` [OidcError](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Common.OidcError 'Abblix\.Oidc\.Server\.Common\.OidcError') {#Abblix.Oidc.Server.Mvc.ActionResults.ActionResultExtensions.Format(thisAbblix.Oidc.Server.Common.OidcError,int,string,System.Collections.Generic.IEnumerable_string_,bool).error}

###### `fallbackStatusCode` [System\.Int32](https://learn.microsoft.com/en-us/dotnet/api/system.int32 'System\.Int32') {#Abblix.Oidc.Server.Mvc.ActionResults.ActionResultExtensions.Format(thisAbblix.Oidc.Server.Common.OidcError,int,string,System.Collections.Generic.IEnumerable_string_,bool).fallbackStatusCode}

###### `realm` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.Oidc.Server.Mvc.ActionResults.ActionResultExtensions.Format(thisAbblix.Oidc.Server.Common.OidcError,int,string,System.Collections.Generic.IEnumerable_string_,bool).realm}

###### `dpopAlgs` [System\.Collections\.Generic\.IEnumerable&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.ienumerable-1 'System\.Collections\.Generic\.IEnumerable\`1')[System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.ienumerable-1 'System\.Collections\.Generic\.IEnumerable\`1') {#Abblix.Oidc.Server.Mvc.ActionResults.ActionResultExtensions.Format(thisAbblix.Oidc.Server.Common.OidcError,int,string,System.Collections.Generic.IEnumerable_string_,bool).dpopAlgs}

###### `advertiseBearer` [System\.Boolean](https://learn.microsoft.com/en-us/dotnet/api/system.boolean 'System\.Boolean') {#Abblix.Oidc.Server.Mvc.ActionResults.ActionResultExtensions.Format(thisAbblix.Oidc.Server.Common.OidcError,int,string,System.Collections.Generic.IEnumerable_string_,bool).advertiseBearer}

#### Returns
[Microsoft\.AspNetCore\.Mvc\.ActionResult](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.actionresult 'Microsoft\.AspNetCore\.Mvc\.ActionResult')

## ActionResultExtensions\.WithAntiFramingHeaders\(this ActionResult\) Method {#Abblix.Oidc.Server.Mvc.ActionResults.ActionResultExtensions.WithAntiFramingHeaders(thisMicrosoft.AspNetCore.Mvc.ActionResult)}

Decorates a self\-rendered HTML result \(the form\_post auto\-submit page\) with the anti\-framing headers so it
can never be embedded in another origin's frame \(clickjacking defense, RFC 9700 Section 4\.16\)\. The check\_session
page cannot use this path: its CSP carries a per\-request nonce generated inside the result, so it sets the
header itself\.

```csharp
public static Microsoft.AspNetCore.Mvc.ActionResult WithAntiFramingHeaders(this Microsoft.AspNetCore.Mvc.ActionResult innerResult);
```
#### Parameters

###### `innerResult` [Microsoft\.AspNetCore\.Mvc\.ActionResult](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.actionresult 'Microsoft\.AspNetCore\.Mvc\.ActionResult') {#Abblix.Oidc.Server.Mvc.ActionResults.ActionResultExtensions.WithAntiFramingHeaders(thisMicrosoft.AspNetCore.Mvc.ActionResult).innerResult}

The HTML\-producing [Microsoft\.AspNetCore\.Mvc\.ActionResult](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.actionresult 'Microsoft\.AspNetCore\.Mvc\.ActionResult') to protect\.

#### Returns
[Microsoft\.AspNetCore\.Mvc\.ActionResult](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.actionresult 'Microsoft\.AspNetCore\.Mvc\.ActionResult')  
A decorated [Microsoft\.AspNetCore\.Mvc\.ActionResult](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.actionresult 'Microsoft\.AspNetCore\.Mvc\.ActionResult') that emits the anti\-framing headers\.

## ActionResultExtensions\.WithAppendCookie\(this ActionResult, string, string, CookieOptions\) Method {#Abblix.Oidc.Server.Mvc.ActionResults.ActionResultExtensions.WithAppendCookie(thisMicrosoft.AspNetCore.Mvc.ActionResult,string,string,Microsoft.AspNetCore.Http.CookieOptions)}

Decorates an [Microsoft\.AspNetCore\.Mvc\.ActionResult](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.actionresult 'Microsoft\.AspNetCore\.Mvc\.ActionResult') to append a cookie to the response\.

```csharp
public static Microsoft.AspNetCore.Mvc.ActionResult WithAppendCookie(this Microsoft.AspNetCore.Mvc.ActionResult innerResult, string name, string value, Microsoft.AspNetCore.Http.CookieOptions options);
```
#### Parameters

###### `innerResult` [Microsoft\.AspNetCore\.Mvc\.ActionResult](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.actionresult 'Microsoft\.AspNetCore\.Mvc\.ActionResult') {#Abblix.Oidc.Server.Mvc.ActionResults.ActionResultExtensions.WithAppendCookie(thisMicrosoft.AspNetCore.Mvc.ActionResult,string,string,Microsoft.AspNetCore.Http.CookieOptions).innerResult}

The [Microsoft\.AspNetCore\.Mvc\.ActionResult](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.actionresult 'Microsoft\.AspNetCore\.Mvc\.ActionResult') to decorate\.

###### `name` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.Oidc.Server.Mvc.ActionResults.ActionResultExtensions.WithAppendCookie(thisMicrosoft.AspNetCore.Mvc.ActionResult,string,string,Microsoft.AspNetCore.Http.CookieOptions).name}

The name of the cookie to append\.

###### `value` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.Oidc.Server.Mvc.ActionResults.ActionResultExtensions.WithAppendCookie(thisMicrosoft.AspNetCore.Mvc.ActionResult,string,string,Microsoft.AspNetCore.Http.CookieOptions).value}

The value of the cookie\.

###### `options` [Microsoft\.AspNetCore\.Http\.CookieOptions](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.http.cookieoptions 'Microsoft\.AspNetCore\.Http\.CookieOptions') {#Abblix.Oidc.Server.Mvc.ActionResults.ActionResultExtensions.WithAppendCookie(thisMicrosoft.AspNetCore.Mvc.ActionResult,string,string,Microsoft.AspNetCore.Http.CookieOptions).options}

The [Microsoft\.AspNetCore\.Http\.CookieOptions](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.http.cookieoptions 'Microsoft\.AspNetCore\.Http\.CookieOptions') to configure the cookie\.

#### Returns
[Microsoft\.AspNetCore\.Mvc\.ActionResult](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.actionresult 'Microsoft\.AspNetCore\.Mvc\.ActionResult')  
A decorated [Microsoft\.AspNetCore\.Mvc\.ActionResult](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.actionresult 'Microsoft\.AspNetCore\.Mvc\.ActionResult') that appends the specified cookie\.

## ActionResultExtensions\.WithAppendHeader\(this ActionResult, string, IEnumerable\<string\>\) Method {#Abblix.Oidc.Server.Mvc.ActionResults.ActionResultExtensions.WithAppendHeader(thisMicrosoft.AspNetCore.Mvc.ActionResult,string,System.Collections.Generic.IEnumerable_string_)}

Decorates an [Microsoft\.AspNetCore\.Mvc\.ActionResult](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.actionresult 'Microsoft\.AspNetCore\.Mvc\.ActionResult') to append each value as a separate header line\.
Use when the wire form expects multiple header lines under the same name \(e\.g\. RFC 9449
§7\.1 dual `WWW-Authenticate` emission for DPoP and Bearer\); plain
[WithHeader\(this ActionResult, string, string\)](https://www.abblix.com/en/docs/api/abblix-oidc-server-mvc/Abblix.Oidc.Server.Mvc.ActionResults.ActionResultExtensions#Abblix.Oidc.Server.Mvc.ActionResults.ActionResultExtensions.WithHeader(thisMicrosoft.AspNetCore.Mvc.ActionResult,string,string) 'Abblix\.Oidc\.Server\.Mvc\.ActionResults\.ActionResultExtensions\.WithHeader\(this Microsoft\.AspNetCore\.Mvc\.ActionResult, string, string\)') overwrites instead of appending\.

```csharp
public static Microsoft.AspNetCore.Mvc.ActionResult WithAppendHeader(this Microsoft.AspNetCore.Mvc.ActionResult innerResult, string name, System.Collections.Generic.IEnumerable<string> values);
```
#### Parameters

###### `innerResult` [Microsoft\.AspNetCore\.Mvc\.ActionResult](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.actionresult 'Microsoft\.AspNetCore\.Mvc\.ActionResult') {#Abblix.Oidc.Server.Mvc.ActionResults.ActionResultExtensions.WithAppendHeader(thisMicrosoft.AspNetCore.Mvc.ActionResult,string,System.Collections.Generic.IEnumerable_string_).innerResult}

###### `name` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.Oidc.Server.Mvc.ActionResults.ActionResultExtensions.WithAppendHeader(thisMicrosoft.AspNetCore.Mvc.ActionResult,string,System.Collections.Generic.IEnumerable_string_).name}

###### `values` [System\.Collections\.Generic\.IEnumerable&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.ienumerable-1 'System\.Collections\.Generic\.IEnumerable\`1')[System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.ienumerable-1 'System\.Collections\.Generic\.IEnumerable\`1') {#Abblix.Oidc.Server.Mvc.ActionResults.ActionResultExtensions.WithAppendHeader(thisMicrosoft.AspNetCore.Mvc.ActionResult,string,System.Collections.Generic.IEnumerable_string_).values}

#### Returns
[Microsoft\.AspNetCore\.Mvc\.ActionResult](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.actionresult 'Microsoft\.AspNetCore\.Mvc\.ActionResult')

## ActionResultExtensions\.WithDeleteCookie\(this ActionResult, string, CookieOptions\) Method {#Abblix.Oidc.Server.Mvc.ActionResults.ActionResultExtensions.WithDeleteCookie(thisMicrosoft.AspNetCore.Mvc.ActionResult,string,Microsoft.AspNetCore.Http.CookieOptions)}

Decorates an [Microsoft\.AspNetCore\.Mvc\.ActionResult](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.actionresult 'Microsoft\.AspNetCore\.Mvc\.ActionResult') to delete a cookie from the response\.

```csharp
public static Microsoft.AspNetCore.Mvc.ActionResult WithDeleteCookie(this Microsoft.AspNetCore.Mvc.ActionResult innerResult, string name, Microsoft.AspNetCore.Http.CookieOptions options);
```
#### Parameters

###### `innerResult` [Microsoft\.AspNetCore\.Mvc\.ActionResult](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.actionresult 'Microsoft\.AspNetCore\.Mvc\.ActionResult') {#Abblix.Oidc.Server.Mvc.ActionResults.ActionResultExtensions.WithDeleteCookie(thisMicrosoft.AspNetCore.Mvc.ActionResult,string,Microsoft.AspNetCore.Http.CookieOptions).innerResult}

The [Microsoft\.AspNetCore\.Mvc\.ActionResult](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.actionresult 'Microsoft\.AspNetCore\.Mvc\.ActionResult') to decorate\.

###### `name` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.Oidc.Server.Mvc.ActionResults.ActionResultExtensions.WithDeleteCookie(thisMicrosoft.AspNetCore.Mvc.ActionResult,string,Microsoft.AspNetCore.Http.CookieOptions).name}

The name of the cookie to delete\.

###### `options` [Microsoft\.AspNetCore\.Http\.CookieOptions](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.http.cookieoptions 'Microsoft\.AspNetCore\.Http\.CookieOptions') {#Abblix.Oidc.Server.Mvc.ActionResults.ActionResultExtensions.WithDeleteCookie(thisMicrosoft.AspNetCore.Mvc.ActionResult,string,Microsoft.AspNetCore.Http.CookieOptions).options}

The [Microsoft\.AspNetCore\.Http\.CookieOptions](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.http.cookieoptions 'Microsoft\.AspNetCore\.Http\.CookieOptions') to configure the deletion of the cookie\.

#### Returns
[Microsoft\.AspNetCore\.Mvc\.ActionResult](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.actionresult 'Microsoft\.AspNetCore\.Mvc\.ActionResult')  
A decorated [Microsoft\.AspNetCore\.Mvc\.ActionResult](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.actionresult 'Microsoft\.AspNetCore\.Mvc\.ActionResult') that deletes the specified cookie\.

## ActionResultExtensions\.WithHeader\(this ActionResult, string, string\) Method {#Abblix.Oidc.Server.Mvc.ActionResults.ActionResultExtensions.WithHeader(thisMicrosoft.AspNetCore.Mvc.ActionResult,string,string)}

Decorates an [Microsoft\.AspNetCore\.Mvc\.ActionResult](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.actionresult 'Microsoft\.AspNetCore\.Mvc\.ActionResult') to append a header to the response\.

```csharp
public static Microsoft.AspNetCore.Mvc.ActionResult WithHeader(this Microsoft.AspNetCore.Mvc.ActionResult innerResult, string name, string value);
```
#### Parameters

###### `innerResult` [Microsoft\.AspNetCore\.Mvc\.ActionResult](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.actionresult 'Microsoft\.AspNetCore\.Mvc\.ActionResult') {#Abblix.Oidc.Server.Mvc.ActionResults.ActionResultExtensions.WithHeader(thisMicrosoft.AspNetCore.Mvc.ActionResult,string,string).innerResult}

The [Microsoft\.AspNetCore\.Mvc\.ActionResult](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.actionresult 'Microsoft\.AspNetCore\.Mvc\.ActionResult') to decorate\.

###### `name` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.Oidc.Server.Mvc.ActionResults.ActionResultExtensions.WithHeader(thisMicrosoft.AspNetCore.Mvc.ActionResult,string,string).name}

The name of the header to append\.

###### `value` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.Oidc.Server.Mvc.ActionResults.ActionResultExtensions.WithHeader(thisMicrosoft.AspNetCore.Mvc.ActionResult,string,string).value}

The value of the header\.

#### Returns
[Microsoft\.AspNetCore\.Mvc\.ActionResult](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.actionresult 'Microsoft\.AspNetCore\.Mvc\.ActionResult')  
A decorated [Microsoft\.AspNetCore\.Mvc\.ActionResult](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.actionresult 'Microsoft\.AspNetCore\.Mvc\.ActionResult') that appends the specified header\.
