Results 1 to 11 of 11

Thread: How to create subdomain programmatically in VB.NET

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jun 2007
    Posts
    241

    Thumbs up How to create subdomain programmatically in VB.NET

    Hi,
    I am developing a project in .net and vb.net, offering free web hosting with subdomain,
    like Geocities and Tripod.

    but i dont know that how to create subdomain programmatically by vb.net coding.

    As the user will fill the member forms and will become the member , he will get a url like
    http://subdomain.domain.com automatically,
    i have no idea about subdomain creation dynamically , got my point
    if you have any idea about subdomain creation programmatically in any language or having any general idea help me
    Thanx in advance
    Failing to plan is Planning to fail

  2. #2
    Lively Member
    Join Date
    Jun 2003
    Posts
    89

    Re: How to create subdomain programmatically in VB.NET

    Well, it's not a simple task.

    First, make sure you have a wildcard third level domain in your nameserver. Something like this:

    *.domain.com CNAME domain.com
    domain.com A youripaddress

    Then, configure IIS so that it shows your website whenever a request to any.domain.com arrives. I'm not sure it supports wildcards in host header names so I can't really help you here.

    Now it's the time to write your httphandler. Create an empty class file in your /App_Code folder like this:

    Code:
    namespace Yournamespace
    {
        public class YourHandler : IHttpHandlerFactory
        {
            public IHttpHandler GetHandler(HttpContext context, string requestType, string url, string pathTranslated)
            {
                //handler logic here
    
                   return PageParser.GetCompiledPageInstance(url, pathTranslated, context);
            }
            public void ReleaseHandler(IHttpHandler handler)
            {
    
            }
        }
    }


    Finally, add this to your web config:
    Code:
    <configuration>
     <system.web>
    <httpHandlers>
    <add verb="*" path="*.aspx" type="Yournamespace.YourHandler" />
    </httpHandlers>
    </system.web>
    </configuration>
    - mo! I said MOOOOOOO!!
    - ...yep, that's a cow, alright.

  3. #3
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: How to create subdomain programmatically in VB.NET

    Hey,

    To do the configuration of IIS, you will have to use something like WMI. Here is an article about it:

    http://msdn.microsoft.com/en-us/library/ms525309.aspx

    Gary

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Jun 2007
    Posts
    241

    Thumbs up Re: How to create subdomain programmatically in VB.NET

    Hi Bright,

    Thanks for yours reply. We dont have wildcard. We buy from webfusion that domain name. We have user name and password from this site. But we are creating all these things previously i told that using manually in this site. But what our requirement is need to create in programmatically. we have ip address host name, username and password.

    Please suggest to me. Hope yours reply.

    Thanks
    Failing to plan is Planning to fail

  5. #5
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: How to create subdomain programmatically in VB.NET

    Hey,

    It sounds to me what you are trying to do is to automate the manual process that you are having to do through the webfusion web site? Is that correct?

    I thought you had your own IIS instance, that is why I suggested what I did.

    What I think you are after is something using perhaps an HttpWebRequest to send the necessary POST data to create the sub domains.

    Gary

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Jun 2007
    Posts
    241

    Thumbs up Re: How to create subdomain programmatically in VB.NET

    hi gep,

    Are you telling using HTTPWebRequest send the necessary post data?
    I dont understand what you are telling. Could you please explain to me dude??

    Thanks
    Failing to plan is Planning to fail

  7. #7
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: How to create subdomain programmatically in VB.NET

    Hey,

    Well can you confirm exactly what you are trying to do.

    Regardless of the HttpWebRequest, did what I describe actually sound like what you are trying to do?

    Gary

  8. #8
    Lively Member
    Join Date
    Jun 2003
    Posts
    89

    Re: How to create subdomain programmatically in VB.NET

    I'm not familiar with webfusion so I don't really know if they'll let you create a third level domain programmatically, expecially if yours is a webhosting plan rather than a virtual private server plan.

    You might consider giving up the third level domain and create a folder for each user, instead. It's a perfectly viable option and requires no special configuration for the nameserver or IIS.

    Basically, you let your users have this page:
    yourdomain.com/username

    instead of
    username.yourdomain.com

    In the end it's just a matter of semantics for your users, but you will benefit from a simplified management if you choose the first.

    Even linkedin and facebook use a folder for their users. Mind that this hasn't to be a physical folder as you can show the right content for a user with just 1 page and a httphandler (for rewriting URLs).
    - mo! I said MOOOOOOO!!
    - ...yep, that's a cow, alright.

  9. #9
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: How to create subdomain programmatically in VB.NET

    Webhosts will not be happy with you programmatically bypassing their control system - what I mean is that they won't allow you to programmatically create subdomains and give you that kind of access to IIS. You'll have to find another way as shown above.

  10. #10

    Thread Starter
    Addicted Member
    Join Date
    Jun 2007
    Posts
    241

    Thumbs up Re: How to create subdomain programmatically in VB.NET

    hi gep

    yeah you are right. I am doing manually that creating subdomain and mailboxes.

    Thats y i m asking, Is it possible to create vb.net coding using webfusion??

    Please suggest me. Hope yours reply, it might be helpful to me.

    Thanks
    Failing to plan is Planning to fail

  11. #11
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: How to create subdomain programmatically in VB.NET

    Hey,

    No, you are not going to be able to programmatically access Webfusion's servers directly, but you "could" to an extent, automate the clicks and posts that you would need to make against the website, using HttpWebRequest.

    Whether or not your ISP will like you doing this, is another question.

    Gary

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width