问题
I am digging from 3 days all over the Stackoverflow and google. I am not getting any exact steps, how to accomplish it... I read all these questions on stackoverflow, many person asked this same question and not got exact Steps to do this Task.
subdomain rewriting in ASP.NET?
https://serverfault.com/questions/58050/generating-content-based-on-subdomain
Creating subdomains on the fly
ASP.NET virtual subdomain via Rewrite
How to add a subdomain to an asp.net website?
How to allow users to create their own subdomains on my MVC website?
web.config rule for sub-directory to sub-domain redirection
Use Web.Config to redirect a directory to a subdomain
URL Rewrite for subdomains in ASP.Net
Now this is i am trying to do: When user register on my website, that time create a subdomain with user name like this
< username >.domain.com like abc.domain.com, xyz.domain.com
and It must points to domain.com/Users/< username >/index.asp
This is a good example http://ytmnd.com/
I am using Windows hosting with IIS7 and i am using asp.net.
I set the Wildcard entry in DNS, when user hit < anyname >.domain.com then it pointing to default Plesk webpage of server;
I dnt have any clue it suppose to work like that or it should point to my main domain.com
Please Provide me steps to complete this task Thanks
回答1:
Why can't you use the answer provided in your own link?
How to allow users to create their own subdomains on my MVC website?
The bind DNS server and Microsoft DNS server both allow to setup a wildcard entry that match any nonexisting entry in the domain:
*.example.com. 3600 IN CNAME host1.example.com. Then you setup an URL rewrite rule in the IIS that turns the URL of the form http://subdomain.yourdomain.com/ into, say, http://yourdomain.com/?root=subdomain
This will allow you to manage these cloned sites using a database.
The only drawback is that DNS system does not allow you to setup a wildcard entry of the form www.*.yourdomain.tld
来源:https://stackoverflow.com/questions/14451055/creating-subdomain-for-an-account-on-registration-with-iis7-asp-net