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://mycompany.localhost:54575 HomeController will grab Index action with tenant parameter equal "mycompany"

Clone this wiki locally