This section shows various methods available at Microsoft.AspNetCore.Http.Extensions.UriHelper
.
-
Request.GetDisplayUrl()
shows complete url with host, path and query string of the current request. It's to be used for display purposes only. -
Request.GetEncodedUrl()
returns the combined components of the request URL in a fully escaped form suitable for use in HTTP headers and other HTTP operations. -
UriHelper.GetEncodedPathAndQuery
returns the relative URL of a request. -
UriHelper.FromAbsolute
separates the given absolute URI string into components. -
UriHelper.BuildAbsolute
combines the given URI components into a string that is properly encoded for use in HTTP headers. This sample shows 9 ways on how to use it.
dotnet8