Unlimited Subdomains

Discussion in 'Hosting Services / Control Panel' started by barusa, Feb 29, 2008.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. Steps I have done so far.

    1. I have paid for Unlimited Subdomains.
    2.I uploaded a second Web Application in the main root folder, for example "/subproduct/*.*".
    3. I used the Hosting Control Panel, Web Application Tool to enable the "/subproduct".

    At this point the web application"www.mydomain.org/subproduct"appears correctly. When I enter"subproduct.mydomain.org" the the "www.mydomain.org" page appears.

    What step(s) have Iskipped or still need to make the the subdomain work correctly?
     
  2. Takeshi Eto

    Takeshi Eto DiscountASP.NET Staff

  3. Hmm... I admit I still only have two years .NET development time, but that article seems incomplete. The following twolines seems a little vague, maybe I am misunderstanding something.

    "The following is a sample script that you can use to redirect a subdomain. You will need to place it as default document on your document root."


    <%



    If InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("subproduct.mydomain.org") ) > 0 Then


    Response.Redirect("/subproduct")


    End If


    %>

    First I am guessing at whatis meant by "default document". I am using master pages.I couldn't place thesample script in my default page without compiler errors, so I tried placing the script in the "masterpage.master" (.aspx, not the.cs codebehind).

    Visual Studio showed a bunch of syntax errors withnearly every element ofthat 'script'. If it is a script, why isn't the code in <script> tags? I ignored the errors and attempted to run the web application anyway (on my local system). I received an error.

    (EDIT: I figured out the error of the script... the script is VB... I am using C#.)


    Post Edited (barusa) : 2/29/2008 5:28:49 PM GMT
     
  4. I think I am getting closer with the following C# script.


    <%


    if (Request.Url.DnsSafeHost.ToLower ().StartsWith ("subproduct"))


    {


    Response.Redirect ("~/subproduct");


    }


    %>

    BUT, this still isn't a true subdomain yet. When entering "subproduct.mydomain.org" the browser refreshes with "subproduct.mydomain.org/subproduct". For a true subdomain, the extra directory levelshould not appear. What is is the easiest way to eliminate the extra directory level, so all subdomains items will look liketheyare attheir own root?


    Post Edited (barusa) : 2/29/2008 6:30:32 PM GMT
     
  5. One thing you will want to test is the different results you'll get from server.transfer vs. Response.Redirect

    If you're still stuck on this give me a better picture of what you want/need and I'll do my best.

    You may also want to run some searches using my Google ASP.NET Coop:
    http://www.google.com/coop/cse?cx=009244845836111659857%3Albvxsjj8mho

    Search http://www.codeplex.com/too, there are several code projects there related to this sort of thing.
    Salute,
    Mark
     
  6. I tried using Server.Transfer. I have read many articles about the Transfer versus Redirect debate, but never had a need for the Server.Transfer. Thus, I admit again my experience might be lacking.

    I tried using Server.Transfer in several combinations. Each time I received an error that is described here, http://support.microsoft.com/kb/320439. Of course, the only answer here is don't use Server.Transfer.

    I would appreciate any help (and experience) you can provide. I will start over describing what I want because maybe the approach I am using is wrong.

    For example when I first login to this site it was http://www.discountasp.net/. When I login it becomes https://my.discountasp.net/news.aspx. Clicking on the forums brings up http://community.discountasp.net/.The forum pages don't appear as http://www.discountasp.net/community or http://community.discountasp.net/community, they have their own root. My expectations is that my that my web site should be able to do something similar.

    I want a main web site for the company, lets call it http://www.mycompany.com. I want a seperate subdomain for high profile products, for example http://flagship.mycompany.com/. I was under the impression having seperate web applications wouldbe usefulinseperatingthe functionality andpages. Thus, I have created two web applications at root, '/', and"/flagship". My expectation is that going to http://flagship.mycompany.com/will appear as the root of an entirely seperate web applecation. In other words, the subdomain should be the root of its own domain. Following along the posts here, the closest I have gotten is that I can now 'redirect' thesubdomain to http://flagship.mycompany.com/flagship. Having thelast flagship directory element is superfluous and shouldn't exist.
     
  7. The DASP crew is really busy with the Windows Server 2008 release but hopefully one of them will chime in on this since they way you need it is the way they are doing it. [​IMG]
    I don't have unlimited subdomains or I'd do some testing for ya.
    In the past I did domain pointing via code here but I used classic asp for it, even redirecting to ASP.NET pages.

    In classic ASP this was a really simple thing to do:

     
  8. It seems to me that you're getting the redirect done, but you don't want the end user to see that a redirect is being done. In other words, you want them to type "mysubdomain.mydomain.com/somepage.aspx" and see the content at www.mydomain.com/subdomain/somepage.aspx but you want their URL to still show what they typed in, right? To do that, you'll need to do some kind of URL rewriting. You can doa Google search on "ASP.NET URL Rewriting" to find several components that will do it and even code to do it yourself. That's the only way you'll get that scenario working on DASP because they don't typically map subdomains directly to folder here. Good luck.
     
  9. I haven't testedthis but it has been getting some good reviews:
    http://www.codeplex.com/urlrewriter


     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page