如何在Startup.cs中获取MVC .net core2中的当前域和子域。我设法在MVC3和4中做到了,但我在与此相关的文档中找不到任何内容。我的启动文件如下所示:
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseBrowserLink();
}
else
{
app.UseExceptionHandler("/Home/Error");
}
app.UseStaticFiles();
string subdomain = //subdomain should come here
string domain = //domain should come here
app.UseMvc(route => CustomRouting.GetRouts(route,domain,subdomain));
}