📜  asp.net core 在视图中获取根 url - C# 代码示例

📅  最后修改于: 2022-03-11 14:48:44.545000             🧑  作者: Mango

代码示例2
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
}