Create Route for a specific URL without changing the URL with MVC

前端 未结 3 1185
栀梦
栀梦 2021-01-19 02:57

I have a MVC Web Application that runs on www.domain.com and I need to configure a different URL binding for another domain www.domain2.com for the

3条回答
  •  梦谈多话
    2021-01-19 03:27

    in the default action of the application make sure that the url is the one of the second domain, then return the method that needs. something like:

          public ActionResult Index()
          {
    
            if (Request.Url.Host.Equals("domain2"))
                return AnotherAction();
    
          }
    

提交回复
热议问题