PageLinkGeneratorExtensions.GetUriByPage Method

Definition

Overloads

GetUriByPage(LinkGenerator, String, String, Object, String, HostString, PathString, FragmentString, LinkOptions)

Generates an absolute URI based on the provided values.

GetUriByPage(LinkGenerator, HttpContext, String, String, Object, String, Nullable<HostString>, Nullable<PathString>, FragmentString, LinkOptions)

Generates an absolute URI based on the provided values.

GetUriByPage(LinkGenerator, String, String, Object, String, HostString, PathString, FragmentString, LinkOptions)

Source:
PageLinkGeneratorExtensions.cs

Generates an absolute URI based on the provided values.

public static string GetUriByPage (this Microsoft.AspNetCore.Routing.LinkGenerator generator, string page, string handler, object values, string scheme, Microsoft.AspNetCore.Http.HostString host, Microsoft.AspNetCore.Http.PathString pathBase = default, Microsoft.AspNetCore.Http.FragmentString fragment = default, Microsoft.AspNetCore.Routing.LinkOptions options = default);
public static string? GetUriByPage (this Microsoft.AspNetCore.Routing.LinkGenerator generator, string page, string? handler, object? values, string scheme, Microsoft.AspNetCore.Http.HostString host, Microsoft.AspNetCore.Http.PathString pathBase = default, Microsoft.AspNetCore.Http.FragmentString fragment = default, Microsoft.AspNetCore.Routing.LinkOptions? options = default);
static member GetUriByPage : Microsoft.AspNetCore.Routing.LinkGenerator * string * string * obj * string * Microsoft.AspNetCore.Http.HostString * Microsoft.AspNetCore.Http.PathString * Microsoft.AspNetCore.Http.FragmentString * Microsoft.AspNetCore.Routing.LinkOptions -> string
<Extension()>
Public Function GetUriByPage (generator As LinkGenerator, page As String, handler As String, values As Object, scheme As String, host As HostString, Optional pathBase As PathString = Nothing, Optional fragment As FragmentString = Nothing, Optional options As LinkOptions = Nothing) As String

Parameters

generator
LinkGenerator

The LinkGenerator.

page
String

The page name. Used to resolve endpoints.

handler
String

The page handler name. May be null.

values
Object

The route values. May be null. Used to resolve endpoints and expand parameters in the route template.

scheme
String

The URI scheme, applied to the resulting URI.

host
HostString

The URI host/authority, applied to the resulting URI.

pathBase
PathString

An optional URI path base. Prepended to the path in the resulting URI.

fragment
FragmentString

A URI fragment. Optional. Appended to the resulting URI.

options
LinkOptions

An optional LinkOptions. Settings on provided object override the settings with matching names from RouteOptions.

Returns

A absolute URI, or null if a URI cannot be created.

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

GetUriByPage(LinkGenerator, HttpContext, String, String, Object, String, Nullable<HostString>, Nullable<PathString>, FragmentString, LinkOptions)

Source:
PageLinkGeneratorExtensions.cs

Generates an absolute URI based on the provided values.

public static string GetUriByPage (this Microsoft.AspNetCore.Routing.LinkGenerator generator, Microsoft.AspNetCore.Http.HttpContext httpContext, string page = default, string handler = default, object values = default, string scheme = default, Microsoft.AspNetCore.Http.HostString? host = default, Microsoft.AspNetCore.Http.PathString? pathBase = default, Microsoft.AspNetCore.Http.FragmentString fragment = default, Microsoft.AspNetCore.Routing.LinkOptions options = default);
public static string? GetUriByPage (this Microsoft.AspNetCore.Routing.LinkGenerator generator, Microsoft.AspNetCore.Http.HttpContext httpContext, string? page = default, string? handler = default, object? values = default, string? scheme = default, Microsoft.AspNetCore.Http.HostString? host = default, Microsoft.AspNetCore.Http.PathString? pathBase = default, Microsoft.AspNetCore.Http.FragmentString fragment = default, Microsoft.AspNetCore.Routing.LinkOptions? options = default);
static member GetUriByPage : Microsoft.AspNetCore.Routing.LinkGenerator * Microsoft.AspNetCore.Http.HttpContext * string * string * obj * string * Nullable<Microsoft.AspNetCore.Http.HostString> * Nullable<Microsoft.AspNetCore.Http.PathString> * Microsoft.AspNetCore.Http.FragmentString * Microsoft.AspNetCore.Routing.LinkOptions -> string
<Extension()>
Public Function GetUriByPage (generator As LinkGenerator, httpContext As HttpContext, Optional page As String = Nothing, Optional handler As String = Nothing, Optional values As Object = Nothing, Optional scheme As String = Nothing, Optional host As Nullable(Of HostString) = Nothing, Optional pathBase As Nullable(Of PathString) = Nothing, Optional fragment As FragmentString = Nothing, Optional options As LinkOptions = Nothing) As String

Parameters

generator
LinkGenerator

The LinkGenerator.

httpContext
HttpContext

The HttpContext associated with the current request.

page
String

The page name. Used to resolve endpoints. Optional. If null is provided, the current page route value will be used.

handler
String

The page handler name. Used to resolve endpoints. Optional.

values
Object

The route values. Optional. Used to resolve endpoints and expand parameters in the route template.

scheme
String

The URI scheme, applied to the resulting URI. Optional. If not provided, the value of Scheme will be used.

host
Nullable<HostString>

The URI host/authority, applied to the resulting URI. Optional. If not provided, the value Host will be used.

pathBase
Nullable<PathString>

An optional URI path base. Prepended to the path in the resulting URI. If not provided, the value of PathBase will be used.

fragment
FragmentString

A URI fragment. Optional. Appended to the resulting URI.

options
LinkOptions

An optional LinkOptions. Settings on provided object override the settings with matching names from RouteOptions.

Returns

A absolute URI, or null if a URI cannot be created.

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