Subdomain Confusion

Discussion in 'Getting started' started by rthornley, May 16, 2009.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. I just added the subdomain addon and I am now trying to figure out how to use it.
    My site currently has a number of folders and files in the root folder. I want to add a staging subdomain as in “staging.mydomain.com” so it seems like I would create “staging” folder at the root level and place my files in there which makes sense.
    What does not make sense to me is what to do with the files and folders that are currently in the root folder for www.mydomain.com. Do I leave the current files and folders as they are, or do they need move them into a folder off the root? If this were true, then I would only have two folders and one file to do the redirecting.
     
  2. Hi,
    DASP allows you to code it how you want.
    When you add your own Sub-domains you can code it to take the visitor/page to any folder or page on your site.
    You do not have to create a folder named "staging" for a sub-domain named "staging" but you can.
    There are code examples in the Support site and you can find many examples here in the forums, plus on the official ASP.NET site.
    Salute,
    Mark
     
  3. Thanks for the reply. I think I have the subdomain figured out but I guess I am still confused on how to handle the current site.

    I want the url of the current site to be www.mydomain.com as that is the "live" site and "staging" is where I will be working on the new aspx version of the site. It looks like the redirect code goes at the top of the file "default.aspx" in the root folder but that is the startup page for my current site. I really do not want my "live" site startup page to be anything other then "default.asp".

    If the redirect code only contains a redirect to "staging.mydomain.com" will the process "fall through" if someone was trying to access my "live" site?

    Thanks
    Richard
     
  4. Here is what I have done so for and my results and questions.

    In my root folder I put the following code at the top of my default.asp:

    <%
    If InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("staging.mydomain.com") ) > 0 Then
    Response.Redirect("/staging")
    End If
    %>

    So with that code "http://www.mydomain.com" works properly since it falls through.

    I created a “staging” subfolder and placed some test pages and another subfolder named “siteadmin”.


    To test I used the url "http://staging.mydomain.com/" which goes to the subdomain put the url looks like http://staging.mydomain.com/staging. The subfolder name is attached to the url which is not what I want.

    I next wanted to see what happens when I try to access the subfolder “siteadmin” in the “staging” folder as in "http://staging.mydomain.com/siteadmin". I tried this code:

    <%
    If InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("staging.mydomain.com/siteadmin") ) > 0 Then
    Response.Redirect("/staging/siteadmin")
    ElseIf InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("staging.mydomain.com") ) > 0 Then
    Response.Redirect("/staging")
    End If
    %>

    But I get the error "The system cannot find the path specified.".

    Can another clear this up for me as I would really like to quit pulling my hair out before I don’t have anymore!

    Thanks,
    Richard
     
  5. Hi,
    You should add at least one more catch or fail/passthrouh to that.
    Instead of dropping the ball if the two strings don't exist add a failure, i.e.:

    Else
    Response.Redirect("http://staging.mydomain.com/staging")
    End If
     
  6. Hello

    Thanks again for the reply but I really must not be explaining this correctly.

    When I type into the browser http://staging.mydomain.com I end up going to http://staging.mydomain.com/staging, not what I want. I want that last "staging" removed.

    When I type into the browser http://staging.mydomain.com/siteadmin I end up with the error, displayed in the browser, "The system cannot find the path specified.

    Can I use IIS at discountasp to take care of the subdomains rather then using redirect code?

    Can anyone help with these issues?

    Thank You,
    Richard
     
  7. Bruce

    Bruce DiscountASP.NET Staff

    No.. IIS cannot handle sub domain going to a sub directory in our setup. TEchnically, you'll have to setup an additional site on IIS to do that.
     
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