UrlHelper Class
Visual Studio 2010
Contains methods to build URLs for ASP.NET MVC within an application.
Assembly: System.Web.Mvc (in System.Web.Mvc.dll)
The UrlHelper type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | UrlHelper(RequestContext) | Initializes a new instance of the UrlHelper class using the specified request context. |
![]() | UrlHelper(RequestContext, RouteCollection) | Initializes a new instance of the UrlHelper class by using the specified request context and route collection. |
| Name | Description | |
|---|---|---|
![]() | RequestContext | Gets information about an HTTP request that matches a defined route. |
![]() | RouteCollection | Gets a collection that contains the routes that are registered for the application. |
| Name | Description | |
|---|---|---|
![]() | Action(String) | Generates a fully qualified URL to an action method by using the specified action name. |
![]() | Action(String, Object) | Generates a fully qualified URL to an action method by using the specified action name and route values. |
![]() | Action(String, String) | Generates a fully qualified URL to an action method by using the specified action name and controller name. |
![]() | Action(String, RouteValueDictionary) | Generates a fully qualified URL to an action method for the specified action name and route values. |
![]() | Action(String, String, Object) | Generates a fully qualified URL to an action method by using the specified action name, controller name, and route values. |
![]() | Action(String, String, RouteValueDictionary) | Generates a fully qualified URL to an action method by using the specified action name, controller name, and route values. |
![]() | Action(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. |
![]() | Action(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. |
![]() | Content | Converts a virtual (relative) path to an application absolute path. |
![]() | Encode | Encodes special characters in a URL string into character-entity equivalents. |
![]() | Equals | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
![]() ![]() | GenerateContentUrl | Returns a string that contains a content URL. |
![]() ![]() | GenerateUrl(String, String, String, RouteValueDictionary, RouteCollection, RequestContext, Boolean) | Returns a string that contains a URL. |
![]() ![]() | GenerateUrl(String, String, String, String, String, String, RouteValueDictionary, RouteCollection, RequestContext, Boolean) | Returns a string that contains a URL. |
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | RouteUrl(Object) | Generates a fully qualified URL for the specified route values. |
![]() | RouteUrl(String) | Generates a fully qualified URL for the specified route name. |
![]() | RouteUrl(RouteValueDictionary) | Generates a fully qualified URL for the specified route values. |
![]() | RouteUrl(String, Object) | Generates a fully qualified URL for the specified route values by using a route name. |
![]() | RouteUrl(String, RouteValueDictionary) | Generates a fully qualified URL for the specified route values by using a route name. |
![]() | RouteUrl(String, Object, String) | Generates a fully qualified URL for the specified route values by using a route name and the protocol to use. |
![]() | RouteUrl(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. |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
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.
Community Additions
ADD
Show:



