MVC obtient une URL de base
Request.Url.GetLeftPart(UriPartial.Authority) + Url.Content("~")
Gleaming Goshawk
Request.Url.GetLeftPart(UriPartial.Authority) + Url.Content("~")
FOR ASP.NET CORE:
public WhateverController(IHttpContextAccessor context) //In the constructor
{
var request = context.HttpContext.Request;
var _baseURL = $"{request.Scheme}://{request.Host}"; // http://localhost:5000
}