Table of Contents

Class UrlHelper

Namespace
System.Web.Http.Routing
Assembly
System.Web.Http.dll

Represents a factory for creating URLs.

public class UrlHelper
Inheritance
UrlHelper
Inherited Members

Constructors

UrlHelper()

Initializes a new instance of the UrlHelper class.

public UrlHelper()

UrlHelper(HttpRequestMessage)

Initializes a new instance of the UrlHelper class.

public UrlHelper(HttpRequestMessage request)

Parameters

request HttpRequestMessage

The HTTP request for this instance.

Properties

Request

Gets or sets the HttpRequestMessage of the current UrlHelper instance.

public HttpRequestMessage Request { get; set; }

Property Value

HttpRequestMessage

The HttpRequestMessage of the current instance.

Methods

Content(string)

Creates an absolute URL using the specified path.

public virtual string Content(string path)

Parameters

path string

The URL path, which may be a relative URL, a rooted URL, or a virtual path.

Returns

string

The generated URL.

Returns a link for the specified route.

public virtual string Link(string routeName, IDictionary<string, object> routeValues)

Parameters

routeName string

The name of the route.

routeValues IDictionary<string, object>

An object that contains the parameters for a route.

Returns

string

A link for the specified route.

Returns a link for the specified route.

public virtual string Link(string routeName, object routeValues)

Parameters

routeName string

The name of the route.

routeValues object

A route value.

Returns

string

A link for the specified route.

Route(string, IDictionary<string, object>)

Returns the route for the UrlHelper.

public virtual string Route(string routeName, IDictionary<string, object> routeValues)

Parameters

routeName string

The name of the route.

routeValues IDictionary<string, object>

A list of route values.

Returns

string

The route for the UrlHelper.

Route(string, object)

Returns the route for the UrlHelper.

public virtual string Route(string routeName, object routeValues)

Parameters

routeName string

The name of the route.

routeValues object

The route values.

Returns

string

The route for the UrlHelper.