Create Virtual Directory programmatically with ASP.Net. RRS feed

  • Question

  • User1540012378 posted
    I notice some community site (eg. YahooGroup, MSNGroup, Circles99, CummunityZero) create virtual directory or subdomain dynamically when user create a new group/commmunity. (eg. http://groups.msn.com/[virtual directory name]/ or http://[subdomain name].groups.yahoo.com) I know it's very difficult to create sub domain - have to configure IIS and DNS. However, is there any way to create virtual directory programmatically with ASP.Net?? the created directory should redirect user to a particular aspx page using "server.transfer". Any idea??
    Thursday, April 1, 2004 10:55 AM

All replies

  • User-528039901 posted
    ::I know it's very difficult to create sub domain - have to configure IIS and DNS. Wrong. * You could use a wildcarding DNS that just returns all subdomains with the same entry. These exist. Even if now, I would call adding a host entry to DNS trivial, not "very difficult". It is about half a page of code, and most deals with other things than the addition. * Noone says you have to configure IIS. Run all such things into ONE iis, then have an ISAPI filter rewrite them into subdirectlry calls. About a page of code aa.domain.com turns into domain.com/aa for IIS. No, ASP.NET is a little late for this, in the processing queue. You need to know C and to get around writing an ISAPI filter. Even IF you condifugre IIS (which makes little sense in these cases), this again is not "very diffculty" but "trivial". Just a good look into the documentation.
    Friday, April 2, 2004 5:46 AM
  • User877716070 posted
    Is there any reason you couldn't use an HTTP module to rewrite the URL? Adding new "sites" or whatever would be a matter of adding a line or two to an XML configuration file. I can't imagine that this kind of solution would be more than a couple dozen lines of code. You can do this even if you don't have full access to the server. Then you don't have to monkey around with an HTTPHandler or (especially) ISAPI filters. I think that creating a subdomain may be a bit of overkill for something like this.
    Friday, April 2, 2004 10:44 AM
  • User1540012378 posted
    Thx! Yes, it indeed easy to create a subdomain in IIS. Anyway, if I need 2 create subdomain programmatically, hav 2 deal with the ISAPI filter. Another thing is if I need to programmatically redirect a virtual directory (eg. aa.com/aa/) which the directory is not existing, have 2 deal with ISAPI filter again. From what I know, the build-in ISAPI filter only able to handle the filename that have extension (eg. *.aspx, *.asp). If the request has no file extension (eg. aa.com/aa), it is considered as directory. If that directory do not exists, it will forward 2 error page. My questions are: 1) where can I get the book, articles, tutorial, or online resources about writing ISAPI filter? 2) is there any available to be downloaded ISAPI filter? such as the mentioned "wildcarding DNS" that just return all subdomains with the same entry. Thx again!
    Wednesday, May 26, 2004 10:08 AM