How to Setup Subdomains

Discussion in 'ASP.NET 2.0' started by Barlow, Sep 18, 2007.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. I have purchased the unlimited subdomains. How do I programitically redirect then. Also can I redirect to a particular page using querystrings. For example.

    http://ryan.test.com -> http://www.test.com/ViewProfile.aspx?username=ryan

    Also, can I not keep the URL in the address bar as the ryan.test.com instead of it showing the ViewProfile URL.

    How do I map URL's when using subdomains. For example I woulda said .NavigateURL = "~/ViewProfile.aspx?username=", but how would I point to teh subdomain w/o typing out "<username>.test.com".
     
  2. Bruce

    Bruce DiscountASP.NET Staff

  3. Where does this example block of code go:




    <%
    If InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("subdomain1.YourHostedDomainName.com") ) > 0 Then
    Response.Redirect("/subdomain1")
    ElseIf InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("subdomain2.YourHostedDomainName.com") ) > 0 Then
    Response.Redirect("/subdomain2")
    ElseIf InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("subdomain3.YourHostedDomainName.com") ) > 0 Then
    Response.Redirect("/subdomain3/home.asp")
    End If
    %>
     
  4. It goes in your site's root level default page .It will redirect to appropriate sub-folder from there.

    Vikram

    DiscountASP.NET
    www.DiscountASP.NET
     
  5. I can't get it to work. In my master file, I put:

    <%
    if (Request.ServerVariables['SERVER_NAME'].ToUpper().IndexOf('fitnesscenters.fitconnect.com'.ToUpper()) > 0)
    Response.Redirect('~/FitnessCenters');
    %>

    If I type in fitnesscenters.fitconnect.com, it just goes to the normal home page, doesn't transfer to www.fitconnect.com/FitnessCenters
     
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