RouteCollection.GetVirtualPath 方法

定义

返回与路由关联的 URL 路径的相关信息。Returns information about the URL path that is associated with the route.

重载

GetVirtualPath(RequestContext, RouteValueDictionary)

如果具有指定的上下文和参数值,则返回与路由关联的 URL 路径的相关信息。Returns information about the URL path that is associated with the route, given the specified context and parameter values.

GetVirtualPath(RequestContext, String, RouteValueDictionary)

如果具有指定的上下文、路由名称和参数值,则返回与命名路由关联的 URL 路径的相关信息。Returns information about the URL path that is associated with the named route, given the specified context, route name, and parameter values.

GetVirtualPath(RequestContext, RouteValueDictionary)

如果具有指定的上下文和参数值,则返回与路由关联的 URL 路径的相关信息。Returns information about the URL path that is associated with the route, given the specified context and parameter values.

public:
 System::Web::Routing::VirtualPathData ^ GetVirtualPath(System::Web::Routing::RequestContext ^ requestContext, System::Web::Routing::RouteValueDictionary ^ values);
public System.Web.Routing.VirtualPathData GetVirtualPath (System.Web.Routing.RequestContext requestContext, System.Web.Routing.RouteValueDictionary values);
member this.GetVirtualPath : System.Web.Routing.RequestContext * System.Web.Routing.RouteValueDictionary -> System.Web.Routing.VirtualPathData

参数

requestContext
RequestContext

一个对象,封装有关所请求的路由的信息。An object that encapsulates information about the requested route.

values
RouteValueDictionary

一个包含路由参数的对象。An object that contains the parameters for a route.

返回

一个对象,其中包含与路由关联的 URL 路径的相关信息。An object that contains information about the URL path that is associated with the route.

另请参阅

GetVirtualPath(RequestContext, String, RouteValueDictionary)

如果具有指定的上下文、路由名称和参数值,则返回与命名路由关联的 URL 路径的相关信息。Returns information about the URL path that is associated with the named route, given the specified context, route name, and parameter values.

public:
 System::Web::Routing::VirtualPathData ^ GetVirtualPath(System::Web::Routing::RequestContext ^ requestContext, System::String ^ name, System::Web::Routing::RouteValueDictionary ^ values);
public System.Web.Routing.VirtualPathData GetVirtualPath (System.Web.Routing.RequestContext requestContext, string name, System.Web.Routing.RouteValueDictionary values);
member this.GetVirtualPath : System.Web.Routing.RequestContext * string * System.Web.Routing.RouteValueDictionary -> System.Web.Routing.VirtualPathData

参数

requestContext
RequestContext

一个对象,封装有关所请求的路由的信息。An object that encapsulates information about the requested route.

name
String

要在检索 URL 路径相关信息时使用的路由的名称。The name of the route to use when information about the URL path is retrieved.

values
RouteValueDictionary

一个包含路由参数的对象。An object that contains the parameters for a route.

返回

一个对象,其中包含与路由关联的 URL 路径的相关信息。An object that contains information about the URL path that is associated with the route.

异常

无法找到具有 name 参数中指定名称的路由。No route could be found that has the name specified in the name parameter.

另请参阅

适用于