Accessing SubDomains

Discussion in 'Getting started' started by Bosco, Apr 21, 2010.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. I'm having trouble accessing a subdomain. I purchased the unlimited subdomains and created a simple web app project for the root folder (softingenuity.com). I created a folder named bma and published another simple web app that just displays a label stating where I am.

    softingenui is my root folder.
    softingenuity.com is my domain.

    I used the following code in my default.cs file:

    protected void Page_Load(object sender, EventArgs e)
    {

    string subDomain = "bma";
    string subDomainUri = @"/softingenui/Default.aspx";

    if (Request.ServerVariables["SERVER_NAME"].ToLower().Contains(subDomain))
    Response.Redirect(subDomainUri);
    }

    When I type in softingenuity.com I get the page I expected but when I type in bma.softingenuity.com, I get a page not found error.

    any help would be appreciated.
     
  2. If you are trying to have your subdomain "bma.softingenuity.com" reference your application within the "bma" folder, your code should reference "bma/Default.aspx".

    Also make sure that you have set your subfolder "bma" as a web application through your hosting control panel.
     
  3. Now I can't load the root folder app or the bma app. Do you see anything in the code that would cause this. I am new to asp.net and c sharp.

    softingenui or root folder default.cs:

    namespace WebApplication13
    {
    public partial class _Default : System.Web.UI.Page
    {
    protected void Page_Load(object sender, EventArgs e)
    {

    string subDomain = "bma";
    string subDomainUri = @"bma/Default.aspx";

    if (Request.ServerVariables["SERVER_NAME"].ToLower().Contains(subDomain))
    Response.Redirect(subDomainUri);
    }
    }
    }




    bma folder default.cs:

    namespace WebApplication14
    {
    public partial class _Default : System.Web.UI.Page
    {
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    }
    }
     
  4. Do you have a working example of the code I need to use to get this working?

    Does it matter that the root folder app is a web app and not a web site?

    Cort
     
  5. Thanks, I think I have the simple version working. Do you have an example of redirecting to web app in a subdomain from an HTML file?

    Thanks in Advance
     
  6. Sorry for the delay. You may view our sample code which is in ASP / ASP.NET we offer on our KB article here
     
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