Share via


JSInvokableAttribute Class

Definition

Identifies a .NET method as allowing invocation from JavaScript code. Any method marked with this attribute may receive arbitrary parameter values from untrusted callers. All inputs should be validated carefully.

C#
[System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple=true)]
public sealed class JSInvokableAttribute : Attribute
Inheritance
JSInvokableAttribute
Attributes

Constructors

JSInvokableAttribute()

Constructs an instance of JSInvokableAttribute without setting an identifier for the method.

JSInvokableAttribute(String)

Constructs an instance of JSInvokableAttribute using the specified identifier.

Properties

Identifier

Gets the identifier for the method. The identifier must be unique within the scope of an assembly.

If not set, the identifier is taken from the name of the method. In this case the method name must be unique within the assembly.

Applies to

Product Versions
ASP.NET Core 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0