Export (0) Print
Expand All

Page.RouteData Property

Gets the RequestContext.RouteData value of the current System.Web.Routing.RequestContext instance.

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

[<BrowsableAttribute(false)>]
member RouteData : RouteData

If a page is running in response to a request made through ASP.NET routing, this property provides access to the URL parameter values that were passed as route data. If the page runs in response to a physical URL instead of a route URL, this property is a null reference (Nothing in Visual Basic). The following example shows how to extract the value of a URL parameter that is named year.

[Visual Basic]

Dim year As Integer = Convert.ToInt32(Page.RouteData.Values("year"))

[C#]

int year = Convert.ToInt32(Page.RouteData.Values["year"])

If the route is defined by using the URL pattern {locale}/{year} for the domain contoso.com, and if the requested URL is contoso.com/US/2010, year will contain the value "2010" when this code runs.

For more information about ASP.NET routing, see ASP.NET Routing.

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

Community Additions

ADD
Show:
© 2014 Microsoft