Export (0) Print
Expand All

UrlHelper Class

Contains methods to build URLs for ASP.NET MVC within an application.

System.Object
  System.Web.Mvc.UrlHelper

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

'Declaration
Public Class UrlHelper
'Usage
Dim instance As UrlHelper

The UrlHelper type exposes the following members.

  NameDescription
Public methodUrlHelper(RequestContext)Initializes a new instance of the UrlHelper class using the specified request context.
Public methodUrlHelper(RequestContext, RouteCollection)Initializes a new instance of the UrlHelper class by using the specified request context and route collection.
Top

  NameDescription
Public propertyRequestContextGets information about an HTTP request that matches a defined route.
Public propertyRouteCollectionGets a collection that contains the routes that are registered for the application.
Top

  NameDescription
Public methodAction(String)Generates a fully qualified URL to an action method by using the specified action name.
Public methodAction(String, Object)Generates a fully qualified URL to an action method by using the specified action name and route values.
Public methodAction(String, String)Generates a fully qualified URL to an action method by using the specified action name and controller name.
Public methodAction(String, RouteValueDictionary)Generates a fully qualified URL to an action method for the specified action name and route values.
Public methodAction(String, String, Object)Generates a fully qualified URL to an action method by using the specified action name, controller name, and route values.
Public methodAction(String, String, RouteValueDictionary)Generates a fully qualified URL to an action method by using the specified action name, controller name, and route values.
Public methodAction(String, String, Object, String)Generates a fully qualified URL to an action method by using the specified action name, controller name, route values, and protocol to use.
Public methodAction(String, String, RouteValueDictionary, String, String)Generates a fully qualified URL for an action method by using the specified action name, controller name, route values, protocol to use, and host name.
Public methodContentConverts a virtual (relative) path to an application absolute path.
Public methodEncodeEncodes special characters in a URL string into character-entity equivalents.
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodStatic memberGenerateContentUrlReturns a string that contains a content URL.
Public methodStatic memberGenerateUrl(String, String, String, RouteValueDictionary, RouteCollection, RequestContext, Boolean)Returns a string that contains a URL.
Public methodStatic memberGenerateUrl(String, String, String, String, String, String, RouteValueDictionary, RouteCollection, RequestContext, Boolean)Returns a string that contains a URL.
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Public methodHttpRouteUrl(String, Object)Generates a fully qualified URL for the specified route values.
Public methodHttpRouteUrl(String, RouteValueDictionary)Generates a fully qualified URL for the specified route values.
Public methodIsLocalUrlReturns a value that indicates whether the URL is local.
Protected methodMemberwiseClone (Inherited from Object.)
Public methodRouteUrl(Object)Generates a fully qualified URL for the specified route values.
Public methodRouteUrl(String)Generates a fully qualified URL for the specified route name.
Public methodRouteUrl(RouteValueDictionary)Generates a fully qualified URL for the specified route values.
Public methodRouteUrl(String, Object)Generates a fully qualified URL for the specified route values by using a route name.
Public methodRouteUrl(String, RouteValueDictionary)Generates a fully qualified URL for the specified route values by using a route name.
Public methodRouteUrl(String, Object, String)Generates a fully qualified URL for the specified route values by using a route name and the protocol to use.
Public methodRouteUrl(String, RouteValueDictionary, String, String)Generates a fully qualified URL for the specified route values by using the specified route name, protocol to use, and host name.
Public methodToString (Inherited from Object.)
Top

The UrlHelper class provides the following methods to help you work with URLs:

  • Action. This method generates a URL that maps to an action method.

  • RouteUrl. This method generates a URL that maps to a route.

  • Content. This method generates a URL path to a resource, based on the virtual (relative) path of the resource.

  • Encode. This method encodes special characters in the specified URL into character-entity equivalents.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft