Dela via


IUrlHelper.Action(UrlActionContext) Method

Definition

Generates a URL with an absolute path for an action method, which contains the action name, controller name, route values, protocol to use, host name, and fragment specified by UrlActionContext. Generates an absolute URL if Protocol and Host are non-null. See the remarks section for important security information.

public:
 System::String ^ Action(Microsoft::AspNetCore::Mvc::Routing::UrlActionContext ^ actionContext);
public string Action (Microsoft.AspNetCore.Mvc.Routing.UrlActionContext actionContext);
public string? Action (Microsoft.AspNetCore.Mvc.Routing.UrlActionContext actionContext);
abstract member Action : Microsoft.AspNetCore.Mvc.Routing.UrlActionContext -> string
Public Function Action (actionContext As UrlActionContext) As String

Parameters

actionContext
UrlActionContext

The context object for the generated URLs for an action method.

Returns

The generated URL.

Remarks

The value of Host should be a trusted value. Relying on the value of the current request can allow untrusted input to influence the resulting URI unless the Host header has been validated. See the deployment documentation for instructions on how to properly validate the Host header in your deployment environment.

Applies to