AuthenticationHttpContextExtensions.ForbidAsync Method

Definition

Overloads

ForbidAsync(HttpContext, String)

Forbid the current request using the specified scheme. Forbid is used when an authenticated user attempts to access a resource they are not permitted to access.

ForbidAsync(HttpContext, String, AuthenticationProperties)

Forbid the current request using the specified scheme. Forbid is used when an authenticated user attempts to access a resource they are not permitted to access.

ForbidAsync(HttpContext)

Forbid the current request using the default forbid scheme. Forbid is used when an authenticated user attempts to access a resource they are not permitted to access. The default forbid scheme can be configured using DefaultForbidScheme.

ForbidAsync(HttpContext, AuthenticationProperties)

Forbid the current request using the default forbid scheme. Forbid is used when an authenticated user attempts to access a resource they are not permitted to access. The default forbid scheme can be configured using DefaultForbidScheme.

ForbidAsync(HttpContext, String)

Source:
AuthenticationHttpContextExtensions.cs
Source:
AuthenticationHttpContextExtensions.cs
Source:
AuthenticationHttpContextExtensions.cs

Forbid the current request using the specified scheme. Forbid is used when an authenticated user attempts to access a resource they are not permitted to access.

C#
public static System.Threading.Tasks.Task ForbidAsync (this Microsoft.AspNetCore.Http.HttpContext context, string scheme);
C#
public static System.Threading.Tasks.Task ForbidAsync (this Microsoft.AspNetCore.Http.HttpContext context, string? scheme);

Parameters

context
HttpContext

The HttpContext context.

scheme
String

The name of the authentication scheme.

Returns

The task.

Applies to

ASP.NET Core 9.0 and other versions
Product Versions
ASP.NET Core 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0

ForbidAsync(HttpContext, String, AuthenticationProperties)

Source:
AuthenticationHttpContextExtensions.cs
Source:
AuthenticationHttpContextExtensions.cs
Source:
AuthenticationHttpContextExtensions.cs

Forbid the current request using the specified scheme. Forbid is used when an authenticated user attempts to access a resource they are not permitted to access.

C#
public static System.Threading.Tasks.Task ForbidAsync (this Microsoft.AspNetCore.Http.HttpContext context, string scheme, Microsoft.AspNetCore.Authentication.AuthenticationProperties properties);
C#
public static System.Threading.Tasks.Task ForbidAsync (this Microsoft.AspNetCore.Http.HttpContext context, string? scheme, Microsoft.AspNetCore.Authentication.AuthenticationProperties? properties);

Parameters

context
HttpContext

The HttpContext context.

scheme
String

The name of the authentication scheme.

Returns

The task.

Applies to

ASP.NET Core 9.0 and other versions
Product Versions
ASP.NET Core 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0

ForbidAsync(HttpContext)

Source:
AuthenticationHttpContextExtensions.cs
Source:
AuthenticationHttpContextExtensions.cs
Source:
AuthenticationHttpContextExtensions.cs

Forbid the current request using the default forbid scheme. Forbid is used when an authenticated user attempts to access a resource they are not permitted to access. The default forbid scheme can be configured using DefaultForbidScheme.

C#
public static System.Threading.Tasks.Task ForbidAsync (this Microsoft.AspNetCore.Http.HttpContext context);

Parameters

context
HttpContext

The HttpContext context.

Returns

The task.

Applies to

ASP.NET Core 9.0 and other versions
Product Versions
ASP.NET Core 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0

ForbidAsync(HttpContext, AuthenticationProperties)

Source:
AuthenticationHttpContextExtensions.cs
Source:
AuthenticationHttpContextExtensions.cs
Source:
AuthenticationHttpContextExtensions.cs

Forbid the current request using the default forbid scheme. Forbid is used when an authenticated user attempts to access a resource they are not permitted to access. The default forbid scheme can be configured using DefaultForbidScheme.

C#
public static System.Threading.Tasks.Task ForbidAsync (this Microsoft.AspNetCore.Http.HttpContext context, Microsoft.AspNetCore.Authentication.AuthenticationProperties properties);
C#
public static System.Threading.Tasks.Task ForbidAsync (this Microsoft.AspNetCore.Http.HttpContext context, Microsoft.AspNetCore.Authentication.AuthenticationProperties? properties);

Parameters

context
HttpContext

The HttpContext context.

Returns

The task.

Applies to

ASP.NET Core 9.0 and other versions
Product Versions
ASP.NET Core 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0