I'd like to have a routing rule that accepted part of my domain name as a parameter. For example:
{name}.mydomain.com/photos/{id}
Is this even possible?
I'd like to have a routing rule that accepted part of my domain name as a parameter. For example:
{name}.mydomain.com/photos/{id}
Is this even possible?
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
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.