อ่านในภาษาอังกฤษ แก้ไข

แชร์ผ่าน


VirtualPathData.VirtualPath Property

Definition

Gets or sets the URL that was created from the route definition.

C#
public string VirtualPath { get; set; }

Property Value

The URL that was generated from a route.

Examples

The following example shows a control that creates a URL based on a route that has parameters that are named action and categoryName.

C#
RouteValueDictionary parameters = new RouteValueDictionary { { "action", "show" }, { "categoryName", "bikes" } };
VirtualPathData vpd = RouteTable.Routes.GetVirtualPath(null, parameters);
HyperLink1.NavigateUrl = vpd.VirtualPath;

Remarks

To generate a URL, you call the GetVirtualPath method. That method returns an instance of the VirtualPathData class, which contains information about the route. The VirtualPath property contains the generated URL.

Applies to

ผลิตภัณฑ์ เวอร์ชัน
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

See also