Share via


UrlHelperExtensions.RouteUrl Method

Definition

Overloads

RouteUrl(IUrlHelper, String, Object, String, String)

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

RouteUrl(IUrlHelper, Object)

Generates a URL with an absolute path for the specified route values.

RouteUrl(IUrlHelper, String)

Generates a URL with an absolute path for the specified routeName.

RouteUrl(IUrlHelper, String, Object)

Generates a URL with an absolute path for the specified routeName and route values.

RouteUrl(IUrlHelper, String, Object, String)

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

RouteUrl(IUrlHelper, String, Object, String, String, String)

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

RouteUrl(IUrlHelper, String, Object, String, String)

Source:
UrlHelperExtensions.cs
Source:
UrlHelperExtensions.cs
Source:
UrlHelperExtensions.cs

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

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

Parameters

helper
IUrlHelper

The IUrlHelper.

routeName
String

The name of the route that is used to generate URL.

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

RouteUrl(IUrlHelper, Object)

Source:
UrlHelperExtensions.cs
Source:
UrlHelperExtensions.cs
Source:
UrlHelperExtensions.cs

Generates a URL with an absolute path for the specified route values.

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

Parameters

helper
IUrlHelper

The IUrlHelper.

values
Object

An object that contains route values.

Returns

The generated URL.

Applies to

RouteUrl(IUrlHelper, String)

Source:
UrlHelperExtensions.cs
Source:
UrlHelperExtensions.cs
Source:
UrlHelperExtensions.cs

Generates a URL with an absolute path for the specified routeName.

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

Parameters

helper
IUrlHelper

The IUrlHelper.

routeName
String

The name of the route that is used to generate URL.

Returns

The generated URL.

Applies to

RouteUrl(IUrlHelper, String, Object)

Source:
UrlHelperExtensions.cs
Source:
UrlHelperExtensions.cs
Source:
UrlHelperExtensions.cs

Generates a URL with an absolute path for the specified routeName and route values.

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

Parameters

helper
IUrlHelper

The IUrlHelper.

routeName
String

The name of the route that is used to generate URL.

values
Object

An object that contains route values.

Returns

The generated URL.

Applies to

RouteUrl(IUrlHelper, String, Object, String)

Source:
UrlHelperExtensions.cs
Source:
UrlHelperExtensions.cs
Source:
UrlHelperExtensions.cs

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

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

Parameters

helper
IUrlHelper

The IUrlHelper.

routeName
String

The name of the route that is used to generate URL.

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

RouteUrl(IUrlHelper, String, Object, String, String, String)

Source:
UrlHelperExtensions.cs
Source:
UrlHelperExtensions.cs
Source:
UrlHelperExtensions.cs

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

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

Parameters

helper
IUrlHelper

The IUrlHelper.

routeName
String

The name of the route that is used to generate URL.

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