Skip to content

HttpRequestExtensions Class

MVC-only Microsoft.AspNetCore.Http.HttpRequest extension that resolves an application-relative path to an absolute URI through the MVC IUriResolver. The framework-neutral URL helpers (GetAppUrl/GetBaseUrl) live in the shared Abblix.Oidc.Server.AspNetCore project.

C#
public static class HttpRequestExtensions

Inheritance System.Object → HttpRequestExtensions

Methods

HttpRequestExtensions.ToAbsoluteUri(this HttpRequest, string) Method

Converts a relative path into an absolute URI using the application's base URL.

C#
public static System.Uri ToAbsoluteUri(this Microsoft.AspNetCore.Http.HttpRequest request, string path);

Parameters

request Microsoft.AspNetCore.Http.HttpRequest

The HTTP request used to access the IUriResolver service.

path System.String

The path to resolve. Supports: - Application-relative paths starting with "~/" (e.g., ~/dashboard) - Route template constants with default values (e.g., [route:authorize?~/connect/authorize]) - Regular relative paths

Returns

System.Uri
A fully qualified System.Uri representing the resolved absolute URL.

Remarks

This extension method delegates to Content(string) for URI resolution.