// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNetCore.Mvc.Routing;
namespace Microsoft.AspNetCore.Mvc
{
///
/// Defines the contract for the helper to build URLs for ASP.NET MVC within an application.
///
public interface IUrlHelper
{
///
/// Gets the for the current request.
///
ActionContext ActionContext { get; }
///
/// Generates a fully qualified or absolute URL specified by for an action
/// method, which contains action name, controller name, route values, protocol to use, host name, and fragment.
///
/// The context object for the generated URLs for an action method.
/// The fully qualified or absolute URL to an action method.
string Action(UrlActionContext actionContext);
///
/// Converts a virtual (relative) path to an application absolute path.
///
///
/// If the specified content path does not start with the tilde (~) character,
/// this method returns unchanged.
///
/// The virtual path of the content.
/// The application absolute path.
string Content(string contentPath);
///
/// Returns a value that indicates whether the URL is local. A URL with an absolute path is considered local
/// if it does not have a host/authority part. URLs using virtual paths ('~/') are also local.
///
/// The URL.
/// true if the URL is local; otherwise, false.
///
///
/// For example, the following URLs are considered local:
/// /Views/Default/Index.html
/// ~/Index.html
///
///
/// The following URLs are non-local:
/// ../Index.html
/// http://www.contoso.com/
/// http://localhost/Index.html
///
///
bool IsLocalUrl(string url);
///
/// Generates a fully qualified or absolute URL specified by , which
/// contains the route name, the route values, protocol to use, host name and fragment.
///
/// The context object for the generated URLs for a route.
/// The fully qualified or absolute URL.
string RouteUrl(UrlRouteContext routeContext);
///
/// Generates an absolute URL using the specified route name and values.
///
/// The name of the route that is used to generate the URL.
/// An object that contains the route values.
/// The generated absolute URL.
///
/// The protocol and host is obtained from the current request.
///
string Link(string routeName, object values);
}
}