MVC 3 Domain Routing

别说谁变了你拦得住时间么 提交于 2019-12-13 04:15:03

问题


I would like to know if the following is possible. I have a website called www.myweb.com. This website could be a directory of say football teams. The list of teams could be found here

www.myweb.com/home/teamlist

On selecting a team one would be take to

www.myweb.com/teams/teama or
www.myweb.com/teams/teamb etc

the content under the teams area would be related to them e.g.

www.myweb.com/teams/teama/fixtures
www.myweb.com/teams/teama/news

i have the above working but would like to know if it is even remotely possible to have a separate website for each team which still uses the current models, views and controllers e.g.

www.teama.com

would go to display the data from

www.myweb.com/teams/teama

where 'teams' is the controller and 'teama' is a parameter for a 'details' action. Also doing

www.teama.com/fixtures 
www.teama.com/news

would display the same stuff as

www.myweb.com/teams/teama/fixtures
www.myweb.com/teams/teama/news

many thanks and hope i have worded it ok.

Rudy


回答1:


I would consider using IIS URL Rewriting in that case.




回答2:


Have a look at MVC Domain Routing, I'm still researching it myself as I have a similar required as yourself but I think that should do what you need.

The following links might be handy:

ASP.Net MVC Domain Routing

Bolt on multi-tenancy in ASP.Net MVC Part I (link to Part II is on the page)



来源:https://stackoverflow.com/questions/11107250/mvc-3-domain-routing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!