Skip to content

Catching subdomain value in controller

Mariusz Kerl edited this page Dec 8, 2017 · 4 revisions

Next thing which we want is to grab subdomain value in our controller.

public class HomeController : Controller
{
    public IActionResult Index(string tenant)
    {
        return View();
    }
}

When user will call url http://contoso.localhost:54575 HomeController will grab Index action with user parameter equal "contoso"

Clone this wiki locally