Class UrlService
Default implementation of IUrlService.
public class UrlService : IUrlService
- Inheritance
-
UrlService
- Implements
- Inherited Members
Constructors
UrlService(IOptions<ServerSettings>, IWebHostEnvironment)
public UrlService(IOptions<ServerSettings> serverSettings, IWebHostEnvironment environment)
Parameters
serverSettingsIOptions<ServerSettings>environmentIWebHostEnvironment
Methods
BuildUrl(string, HttpContext?)
Builds a full URL from a relative path.
public string BuildUrl(string relativePath, HttpContext? httpContext = null)
Parameters
relativePathstringThe relative path (e.g., "/auth/verify-email").
httpContextHttpContextOptional HTTP context for development fallback.
Returns
- string
The full URL.
GetBaseUrl(HttpContext?)
Gets the base URL for the application (e.g., "https://ci.example.com").
public string GetBaseUrl(HttpContext? httpContext = null)
Parameters
httpContextHttpContextOptional HTTP context for development fallback.
Returns
- string
The base URL without trailing slash.