Skip to content

Catching subdomain value in controller

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

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

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

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

Clone this wiki locally