Can have part of the domain name as a parameter in my routing rules?

南楼画角 提交于 2019-12-04 17:32:47

I have had a similar issue in using asp.net mvc, but with using the whole domain instead of just the subdomain. What we used was a custom route constraint to determine which controller to go to (domain determined controller on our project). Then in the controller we used the normal asp.net request.url properties to take an action. This may or may not help depending on your exact requirements.

Parsa

It wouldn't be possible since the {name}.mydomain (a valid name instead of {name}) is the Authority part of a Uri. The routing can be performed only on the PathAndQuery part of a Uri.

Edit: I was somehow wrong, take a look at this answer: Manipulating Url structure

See ASP.NET MVC Domain Routing by Maarten Balliauw.

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