create subdomain in IIS with C#

  • Thread starter Thread starter vtxr1300
  • Start date Start date
V

vtxr1300

I have a web site that allows users to register. When they register,
I'd like to create a subdomain that points to their profile page. Does
anyone know how to do this in IIS through a c# asp.net page? Thanks.
 
When you say "Subdomain", i assume you are talking about host headers? Like,
username.yoursite.com

Yes?
Peter
 
Many so call system administrators want to restrict the right for developer
to create a domain but sometime you won't have a choice. The faster and
efficient way can be just create it using IIS manager. Of course everything
can be done in theory but how efficient is the question that we should ask.

chanmm
 
chanmm said:
Many so call system administrators want to restrict the right for developer
to create a domain but sometime you won't have a choice. The faster and
efficient way can be just create it using IIS manager. Of course everything
can be done in theory but how efficient is the question that we should ask.

chanmm

I already spoke to the host about it and they said they don't have any
problems with me adding the host header programmatically if I can do
it. Now I just have to figure out how. I don't want to have to
manually go in and create it each time someone registers on my site.
 
OK. There are at least 2 ways to do this. One is with IIS Manager and create
host headers. The second and more flexible way is to use an ISAPI filter such
as ISAPI_REWRITE_LITE (that 's the free one) to do this via regex matches and
perform the redirects. For example you could have

peterbromberg.yourdomain.com
map to
yourdomain.com/users/defauilt.aspx?user=peterbromberg

Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
 
I'm with Peter on security and best practice, but you should be able to hook
into the scripting COM object (WSH), find the vbs script (buried somewhere
in system32) that does the IIS stuff and basically pass the same lines of
code through in C#.
 
Back
Top