views:

104

answers:

2

Guys,

How can I dynamically create a host name in ASP.NET? Like if people come to my site, I want to be able to dynamically create them a .Mysite.Com host name. I've seen this done at other sites before but can't seem to find documation on how to do it. Any help would be appreciated. I'm using VB.NET/ASP.NET 2008 and IIS 6.0

A: 

Going to be quite a formidable task..

http://forums.asp.net/t/874598.aspx

madcolor
+3  A: 
  1. Configure the authoritative DNS to resolve any subdomain to the same IP address
  2. Configure the web server at IP address to serve the same web site for any subdomain
  3. Use the HTTP_HOST environment variable to get the DNS name:
Request.ServerVariables["HTTP_HOST"]
dtb
+1 practically my same answer, but better formatting :)
Eduardo Molteni
CNAME record in DNS can you set like: name: "*.Mysite.Com" ttl: "86400" value: "Mysite.Com."
Jan Remunda
Guys, thanks for the replies, but I don't want to have to do it through IIS. I want to be able to automate it through a C# or VB.NET program. Like if you go to http://www.clockspot.net and sign up for an account, and hit the submit button, the site immediately gives you a <username>.clockspot.net URL. This is what I'm trying to accomplish
icemanind
In step 3, check if `HTTP_HOST` is in your username database and return an error page if it doesn't. It seems that's exactly what clockspot does: http://doesnotexist.clockspot.net/
dtb