This documentation is archived and is not being maintained.

RouteUrlExpressionBuilder::GetRouteUrl Method

Creates a URL that corresponds to specified route keys for a route URL format.

Namespace:  System.Web.Compilation
Assembly:  System.Web (in System.Web.dll)

public:
static String^ GetRouteUrl(
	Control^ control, 
	String^ expression
)

Parameters

control
Type: System.Web.UI::Control
The control that the expression is bound to.
expression
Type: System::String
The expression as specified in markup.

Return Value

Type: System::String
The URL that corresponds to the route URL format of the current Route object.

ExceptionCondition
ArgumentNullException

The control parameter is nullptr.

InvalidOperationException

The method was unable to parse the expression that was specified in markup. For more information, see TryParseRouteExpression.

This method generates the appropriate value for the URL by calling the GetVirtualPath method of the RouteCollection object. It gets the RequestContext object from the control parameter, and it parses the route name and route parameters from the expression parameter.

.NET Framework

Supported in: 4

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show: