UrlHelperBase.IsLocalUrl(String) Method

Definition

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.

C#
public virtual bool IsLocalUrl (string url);
C#
public virtual bool IsLocalUrl (string? url);

Parameters

url
String

The URL.

Returns

true if the URL is local; otherwise, false.

Implements

Applies to

Product Versions
ASP.NET Core 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0