// 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 URL with an absolute path for an action method, which contains the action
/// name, controller name, route values, protocol to use, host name, and fragment specified by
/// . Generates an absolute URL if and
/// are non-null.
///
/// The context object for the generated URLs for an action method.
/// The generated URL.
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 is considered local if it does not have a
/// host / authority part and it has an absolute path. 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 URL with an absolute path, which contains the route name, route values, protocol to use, host
/// name, and fragment specified by . Generates an absolute URL if
/// and are non-null.
///
/// The context object for the generated URLs for a route.
/// The generated URL.
string RouteUrl(UrlRouteContext routeContext);
///
/// Generates an absolute URL for the specified and route
/// , which contains the protocol (such as "http" or "https") and host name from the
/// current request.
///
/// The name of the route that is used to generate URL.
/// An object that contains route values.
/// The generated absolute URL.
string Link(string routeName, object values);
}
}