ControllerBase.Forbid Method

Definition

Overloads

Forbid(AuthenticationProperties, String[])

Creates a ForbidResult (Status403Forbidden by default) with the specified authentication schemes and properties.

Forbid()

Creates a ForbidResult (Status403Forbidden by default).

Forbid(AuthenticationProperties)

Creates a ForbidResult (Status403Forbidden by default) with the specified properties.

Forbid(AuthenticationProperties)

Creates a ForbidResult with the specified properties.

Forbid(String[])

Creates a ForbidResult (Status403Forbidden by default) with the specified authentication schemes.

Forbid(AuthenticationProperties, String[])

Creates a ForbidResult with the specified specified authentication schemes and properties.

Forbid(AuthenticationProperties, String[])

Source:
ControllerBase.cs
Source:
ControllerBase.cs
Source:
ControllerBase.cs

Creates a ForbidResult (Status403Forbidden by default) with the specified authentication schemes and properties.

C#
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.ForbidResult Forbid (Microsoft.AspNetCore.Authentication.AuthenticationProperties properties, params string[] authenticationSchemes);

Parameters

properties
AuthenticationProperties

AuthenticationProperties used to perform the authentication challenge.

authenticationSchemes
String[]

The authentication schemes to challenge.

Returns

The created ForbidResult for the response.

Attributes

Remarks

Some authentication schemes, such as cookies, will convert Status403Forbidden to a redirect to show a login page.

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

Forbid()

Source:
ControllerBase.cs
Source:
ControllerBase.cs
Source:
ControllerBase.cs

Creates a ForbidResult (Status403Forbidden by default).

C#
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.ForbidResult Forbid ();

Returns

The created ForbidResult for the response.

Attributes

Remarks

Some authentication schemes, such as cookies, will convert Status403Forbidden to a redirect to show a login page.

Applies to

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

Forbid(AuthenticationProperties)

Source:
ControllerBase.cs
Source:
ControllerBase.cs
Source:
ControllerBase.cs

Creates a ForbidResult (Status403Forbidden by default) with the specified properties.

C#
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.ForbidResult Forbid (Microsoft.AspNetCore.Authentication.AuthenticationProperties properties);

Parameters

properties
AuthenticationProperties

AuthenticationProperties used to perform the authentication challenge.

Returns

The created ForbidResult for the response.

Attributes

Remarks

Some authentication schemes, such as cookies, will convert Status403Forbidden to a redirect to show a login page.

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

Forbid(AuthenticationProperties)

Creates a ForbidResult with the specified properties.

C#
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.ForbidResult Forbid (Microsoft.AspNetCore.Http.Authentication.AuthenticationProperties properties);

Parameters

properties
AuthenticationProperties

AuthenticationProperties used to perform the authentication challenge.

Returns

The created ForbidResult for the response.

Attributes

Applies to

ASP.NET Core 1.1 and ASP.NET Core 1.0
Product Versions
ASP.NET Core 1.0, 1.1

Forbid(String[])

Source:
ControllerBase.cs
Source:
ControllerBase.cs
Source:
ControllerBase.cs

Creates a ForbidResult (Status403Forbidden by default) with the specified authentication schemes.

C#
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.ForbidResult Forbid (params string[] authenticationSchemes);

Parameters

authenticationSchemes
String[]

The authentication schemes to challenge.

Returns

The created ForbidResult for the response.

Attributes

Remarks

Some authentication schemes, such as cookies, will convert Status403Forbidden to a redirect to show a login page.

Applies to

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

Forbid(AuthenticationProperties, String[])

Creates a ForbidResult with the specified specified authentication schemes and properties.

C#
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.ForbidResult Forbid (Microsoft.AspNetCore.Http.Authentication.AuthenticationProperties properties, params string[] authenticationSchemes);

Parameters

properties
AuthenticationProperties

AuthenticationProperties used to perform the authentication challenge.

authenticationSchemes
String[]

The authentication schemes to challenge.

Returns

The created ForbidResult for the response.

Attributes

Applies to

ASP.NET Core 1.1 and ASP.NET Core 1.0
Product Versions
ASP.NET Core 1.0, 1.1