Dynamic subdomains in asp.net mvc

后端 未结 3 1209
夕颜
夕颜 2020-12-28 21:30

I am fairly new to asp.net, and have little experience with iis. I would like to have each user of my application get their own sub-domain, but all use the same controllers.

3条回答
  •  死守一世寂寞
    2020-12-28 22:08

    MVC is not bound to the domain, just to the path (e.g. http://domain/path).

    To do this properly you need the following...

    1. Wildcard DNS setup for *.yourdomain.com pointing to your server.
    2. The site in IIS setup with no Host Header. Any other sites hosted in that instance of IIS on the same IP must have Host headers specified.
    3. Your application will need to check the request host header either on page load, session start or some other event.

提交回复
热议问题