UrlHelperExtensions.Action Method

Definition

Overloads

Action(IUrlHelper)

Generates a URL with a path for an action method.

Action(IUrlHelper, String)

Generates a URL with a path for an action method, which contains the specified action name.

Action(IUrlHelper, String, Object)

Generates a URL with a path for an action method, which contains the specified action name and route values.

Action(IUrlHelper, String, String)

Generates a URL with a path for an action method, which contains the specified action and controller names.

Action(IUrlHelper, String, String, Object)

Generates a URL with a path for an action method, which contains the specified action name, controller name, and route values.

Action(IUrlHelper, String, String, Object, String)

Generates a URL with a path for an action method, which contains the specified action name, controller name, route values, and protocol to use. See the remarks section for important security information.

Action(IUrlHelper, String, String, Object, String, String)

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

Action(IUrlHelper, String, String, Object, String, String, String)

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

Action(IUrlHelper)

Source:
UrlHelperExtensions.cs
Source:
UrlHelperExtensions.cs

Generates a URL with a path for an action method.

public:
[System::Runtime::CompilerServices::Extension]
 static System::String ^ Action(Microsoft::AspNetCore::Mvc::IUrlHelper ^ helper);
public static string Action (this Microsoft.AspNetCore.Mvc.IUrlHelper helper);
public static string? Action (this Microsoft.AspNetCore.Mvc.IUrlHelper helper);
static member Action : Microsoft.AspNetCore.Mvc.IUrlHelper -> string
<Extension()>
Public Function Action (helper As IUrlHelper) As String

Parameters

helper
IUrlHelper

The IUrlHelper.

Returns

The generated URL.

Applies to

Action(IUrlHelper, String)

Source:
UrlHelperExtensions.cs
Source:
UrlHelperExtensions.cs

Generates a URL with a path for an action method, which contains the specified action name.

public:
[System::Runtime::CompilerServices::Extension]
 static System::String ^ Action(Microsoft::AspNetCore::Mvc::IUrlHelper ^ helper, System::String ^ action);
public static string Action (this Microsoft.AspNetCore.Mvc.IUrlHelper helper, string action);
public static string? Action (this Microsoft.AspNetCore.Mvc.IUrlHelper helper, string? action);
static member Action : Microsoft.AspNetCore.Mvc.IUrlHelper * string -> string
<Extension()>
Public Function Action (helper As IUrlHelper, action As String) As String

Parameters

helper
IUrlHelper

The IUrlHelper.

action
String

The name of the action method.

Returns

The generated URL.

Applies to

Action(IUrlHelper, String, Object)

Source:
UrlHelperExtensions.cs
Source:
UrlHelperExtensions.cs

Generates a URL with a path for an action method, which contains the specified action name and route values.

public:
[System::Runtime::CompilerServices::Extension]
 static System::String ^ Action(Microsoft::AspNetCore::Mvc::IUrlHelper ^ helper, System::String ^ action, System::Object ^ values);
public static string Action (this Microsoft.AspNetCore.Mvc.IUrlHelper helper, string action, object values);
public static string? Action (this Microsoft.AspNetCore.Mvc.IUrlHelper helper, string? action, object? values);
static member Action : Microsoft.AspNetCore.Mvc.IUrlHelper * string * obj -> string
<Extension()>
Public Function Action (helper As IUrlHelper, action As String, values As Object) As String

Parameters

helper
IUrlHelper

The IUrlHelper.

action
String

The name of the action method.

values
Object

An object that contains route values.

Returns

The generated URL.

Applies to

Action(IUrlHelper, String, String)

Source:
UrlHelperExtensions.cs
Source:
UrlHelperExtensions.cs

Generates a URL with a path for an action method, which contains the specified action and controller names.

public:
[System::Runtime::CompilerServices::Extension]
 static System::String ^ Action(Microsoft::AspNetCore::Mvc::IUrlHelper ^ helper, System::String ^ action, System::String ^ controller);
public static string Action (this Microsoft.AspNetCore.Mvc.IUrlHelper helper, string action, string controller);
public static string? Action (this Microsoft.AspNetCore.Mvc.IUrlHelper helper, string? action, string? controller);
static member Action : Microsoft.AspNetCore.Mvc.IUrlHelper * string * string -> string
<Extension()>
Public Function Action (helper As IUrlHelper, action As String, controller As String) As String

Parameters

helper
IUrlHelper

The IUrlHelper.

action
String

The name of the action method.

controller
String

The name of the controller.

Returns

The generated URL.

Applies to

Action(IUrlHelper, String, String, Object)

Source:
UrlHelperExtensions.cs
Source:
UrlHelperExtensions.cs

Generates a URL with a path for an action method, which contains the specified action name, controller name, and route values.

public:
[System::Runtime::CompilerServices::Extension]
 static System::String ^ Action(Microsoft::AspNetCore::Mvc::IUrlHelper ^ helper, System::String ^ action, System::String ^ controller, System::Object ^ values);
public static string Action (this Microsoft.AspNetCore.Mvc.IUrlHelper helper, string action, string controller, object values);
public static string? Action (this Microsoft.AspNetCore.Mvc.IUrlHelper helper, string? action, string? controller, object? values);
static member Action : Microsoft.AspNetCore.Mvc.IUrlHelper * string * string * obj -> string
<Extension()>
Public Function Action (helper As IUrlHelper, action As String, controller As String, values As Object) As String

Parameters

helper
IUrlHelper

The IUrlHelper.

action
String

The name of the action method.

controller
String

The name of the controller.

values
Object

An object that contains route values.

Returns

The generated URL.

Applies to

Action(IUrlHelper, String, String, Object, String)

Source:
UrlHelperExtensions.cs
Source:
UrlHelperExtensions.cs

Generates a URL with a path for an action method, which contains the specified action name, controller name, route values, and protocol to use. See the remarks section for important security information.

public:
[System::Runtime::CompilerServices::Extension]
 static System::String ^ Action(Microsoft::AspNetCore::Mvc::IUrlHelper ^ helper, System::String ^ action, System::String ^ controller, System::Object ^ values, System::String ^ protocol);
public static string Action (this Microsoft.AspNetCore.Mvc.IUrlHelper helper, string action, string controller, object values, string protocol);
public static string? Action (this Microsoft.AspNetCore.Mvc.IUrlHelper helper, string? action, string? controller, object? values, string? protocol);
static member Action : Microsoft.AspNetCore.Mvc.IUrlHelper * string * string * obj * string -> string
<Extension()>
Public Function Action (helper As IUrlHelper, action As String, controller As String, values As Object, protocol As String) As String

Parameters

helper
IUrlHelper

The IUrlHelper.

action
String

The name of the action method.

controller
String

The name of the controller.

values
Object

An object that contains route values.

protocol
String

The protocol for the URL, such as "http" or "https".

Returns

The generated URL.

Remarks

This method uses the value of Host to populate the host section of the generated URI. 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

Action(IUrlHelper, String, String, Object, String, String)

Source:
UrlHelperExtensions.cs
Source:
UrlHelperExtensions.cs

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

public:
[System::Runtime::CompilerServices::Extension]
 static System::String ^ Action(Microsoft::AspNetCore::Mvc::IUrlHelper ^ helper, System::String ^ action, System::String ^ controller, System::Object ^ values, System::String ^ protocol, System::String ^ host);
public static string Action (this Microsoft.AspNetCore.Mvc.IUrlHelper helper, string action, string controller, object values, string protocol, string host);
public static string? Action (this Microsoft.AspNetCore.Mvc.IUrlHelper helper, string? action, string? controller, object? values, string? protocol, string? host);
static member Action : Microsoft.AspNetCore.Mvc.IUrlHelper * string * string * obj * string * string -> string
<Extension()>
Public Function Action (helper As IUrlHelper, action As String, controller As String, values As Object, protocol As String, host As String) As String

Parameters

helper
IUrlHelper

The IUrlHelper.

action
String

The name of the action method.

controller
String

The name of the controller.

values
Object

An object that contains route values.

protocol
String

The protocol for the URL, such as "http" or "https".

host
String

The host name for the URL.

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

Action(IUrlHelper, String, String, Object, String, String, String)

Source:
UrlHelperExtensions.cs
Source:
UrlHelperExtensions.cs

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

public:
[System::Runtime::CompilerServices::Extension]
 static System::String ^ Action(Microsoft::AspNetCore::Mvc::IUrlHelper ^ helper, System::String ^ action, System::String ^ controller, System::Object ^ values, System::String ^ protocol, System::String ^ host, System::String ^ fragment);
public static string Action (this Microsoft.AspNetCore.Mvc.IUrlHelper helper, string action, string controller, object values, string protocol, string host, string fragment);
public static string? Action (this Microsoft.AspNetCore.Mvc.IUrlHelper helper, string? action, string? controller, object? values, string? protocol, string? host, string? fragment);
static member Action : Microsoft.AspNetCore.Mvc.IUrlHelper * string * string * obj * string * string * string -> string
<Extension()>
Public Function Action (helper As IUrlHelper, action As String, controller As String, values As Object, protocol As String, host As String, fragment As String) As String

Parameters

helper
IUrlHelper

The IUrlHelper.

action
String

The name of the action method.

controller
String

The name of the controller.

values
Object

An object that contains route values.

protocol
String

The protocol for the URL, such as "http" or "https".

host
String

The host name for the URL.

fragment
String

The fragment for the URL.

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