Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

UrlHelperExtensions.Page Method

Definition

Namespace:
Microsoft.AspNetCore.Mvc
Assembly:
Microsoft.AspNetCore.Mvc.Core.dll
Package:
Microsoft.AspNetCore.App.Ref v10.0.0
Package:
Microsoft.AspNetCore.App.Ref v11.0.0-preview.4.26230.115
Package:
Microsoft.AspNetCore.Mvc.Core v2.0.0
Package:
Microsoft.AspNetCore.Mvc.Core v2.1.0
Package:
Microsoft.AspNetCore.Mvc.Core v2.2.0
Package:
Microsoft.AspNetCore.App.Ref v3.0.1
Package:
Microsoft.AspNetCore.App.Ref v3.1.10
Package:
Microsoft.AspNetCore.App.Ref v5.0.0
Package:
Microsoft.AspNetCore.App.Ref v6.0.36
Package:
Microsoft.AspNetCore.App.Ref v7.0.5
Package:
Microsoft.AspNetCore.App.Ref v8.0.19
Package:
Microsoft.AspNetCore.App.Ref v9.0.8

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Overloads

Name Description
Page(IUrlHelper, String, String, Object, String, String, String)

Generates a URL with an absolute path for the specified pageName. See the remarks section for important security information.

Page(IUrlHelper, String, String, Object, String, String)

Generates a URL with an absolute path for the specified pageName. See the remarks section for important security information.

Page(IUrlHelper, String, String, Object, String)

Generates a URL with an absolute path for the specified pageName. See the remarks section for important security information.

Page(IUrlHelper, String, String)

Generates a URL with a relative path for the specified pageName.

Page(IUrlHelper, String, Object)

Generates a URL with a relative path for the specified pageName.

Page(IUrlHelper, String)

Generates a URL with a relative path for the specified pageName.

Page(IUrlHelper, String, String, Object)

Generates a URL with a relative path for the specified pageName.

Page(IUrlHelper, String, String, Object, String, String, String)

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

Generates a URL with an absolute path for the specified pageName. See the remarks section for important security information.

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

Parameters

urlHelper
IUrlHelper

The IUrlHelper.

pageName
String

The page name to generate the url for.

pageHandler
String

The handler to generate the url for.

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

Page(IUrlHelper, String, String, Object, String, String)

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

Generates a URL with an absolute path for the specified pageName. See the remarks section for important security information.

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

Parameters

urlHelper
IUrlHelper

The IUrlHelper.

pageName
String

The page name to generate the url for.

pageHandler
String

The handler to generate the url for.

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

Page(IUrlHelper, String, String, Object, String)

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

Generates a URL with an absolute path for the specified pageName. See the remarks section for important security information.

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

Parameters

urlHelper
IUrlHelper

The IUrlHelper.

pageName
String

The page name to generate the url for.

pageHandler
String

The handler to generate the url for.

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

Page(IUrlHelper, String, String)

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

Generates a URL with a relative path for the specified pageName.

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

Parameters

urlHelper
IUrlHelper

The IUrlHelper.

pageName
String

The page name to generate the url for.

pageHandler
String

The handler to generate the url for.

Returns

The generated URL.

Applies to

Page(IUrlHelper, String, Object)

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

Generates a URL with a relative path for the specified pageName.

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

Parameters

urlHelper
IUrlHelper

The IUrlHelper.

pageName
String

The page name to generate the url for.

values
Object

An object that contains route values.

Returns

The generated URL.

Applies to

Page(IUrlHelper, String)

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

Generates a URL with a relative path for the specified pageName.

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

Parameters

urlHelper
IUrlHelper

The IUrlHelper.

pageName
String

The page name to generate the url for.

Returns

The generated URL.

Applies to

Page(IUrlHelper, String, String, Object)

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

Generates a URL with a relative path for the specified pageName.

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

Parameters

urlHelper
IUrlHelper

The IUrlHelper.

pageName
String

The page name to generate the url for.

pageHandler
String

The handler to generate the url for.

values
Object

An object that contains route values.

Returns

The generated URL.

Applies to


Feedback

Was this page helpful?