This documentation is archived and is not being maintained.

RouteUrlExpressionBuilder::TryParseRouteExpression Method

Parses an expression into a collection of route keys and values, and optionally into a route name.

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

public:
static bool TryParseRouteExpression(
	String^ expression, 
	RouteValueDictionary^ routeValues, 
	[OutAttribute] String^% routeName
)

Parameters

expression
Type: System::String
The expression as specified in markup.
routeValues
Type: System.Web.Routing::RouteValueDictionary
The collection of route keys and their associated values.
routeName
Type: System::String%
When this method returns, contains a string that represents the name of the route, if expression contains a route key named RouteName. This parameter is passed uninitialized.

Return Value

Type: System::Boolean
true if parsing was successful; otherwise, false.

The TryParseRouteExpression method strips leading and trailing spaces from the expression, and then splits it into key/value pairs by using commas as delimiters. If the route key named RouteName is found, that value is passed back in the routeName parameter and not in routeValues. Otherwise, nullptr is returned for routeName. Leading and trailing spaces are also stripped from individual keys and values.

The TryParseRouteExpression method returns false if the expression is not composed of at least one key/value pair that is in the format key=value, and that uses commas to separate multiple pairs.

.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: