Is the example below is what is referred to as a subSite? Example: my site: www.MySite.com sub Domain: www.support.MySite.com<--------How do i set this up? Is something like this set up under my root directory but just all togeather another site? thanks erik Post Edited By Moderator (mjp) : 5/16/2007 7:13:58 PM GMT
that's calleda subdomain. In order to use subdomains with discountasp you need to get the unlimited subdomains addon (5$ a month extra i think it was) How it works is, you create a default page in your root and put code in the load event that checks the address used to get to it for a subdomain and then does a response.redirect to the appropriate page.
Hey thanks for the help! erik http://www.ErikLittle.com http://www.StarterSolutions.com http://www.BidWar.com http://www.constructionsupercenter.com http://www.BuildersStop.com http://www.ContractorsStop.com http://www.ProjectMaterials.com http://www.RehabMaterials.com http://www.RehabCafe.com http://www.SuperCenterPages.com http://www.SuperPagesDirectory.com
Help! I just discovered this thread from last year, and wish to participate. Daniel: Two questions - 1) There were two sets of code in the reply you gave. The first was - private string GetSubdomain() { string domain = HttpContext.Current.Request.ServerVariables["SERVER_NAME"].ToLower(); domain = domain.Replace("www.", ""); int firstDot = domain.IndexOf("."); if (firstDot < 0) return null; string subDomain = domain.Substring(0, firstDot); if (subDomain == "mydomain") return null; return subDomain; } and the second (which I believe you added) was - protected void Page_Load(object sender, EventArgs e) { string Target = GetSubdomain(); if (Target == "MySitename") // requested the root domain. Response.Redirect("Default.aspx"); //Send them to the default page in root. else //requested a subdomain if (Target == "support") //support subdomain Response.Redirect(\\support\\); // Send them to the \Support folder. else // Was not the root ora recognised subdomain throw (new Exception("Invalid subdomain")); }</BLOCKQUOTE> Are BOTH necessary?</BLOCKQUOTE> 2) I tried putting just the second into a default page, and when I go to my site in either case, I only see the code I put in. So where does this code go? I tried it within the <head> tags and within the tags, with the same result. What am I missing here? This is probably simple, but I am not much of a programmer. I copy things fairly well, but do not always understand them at first. So if you can provide any hint, I would appreciate it. Thank you. -Ed Payne ([email protected])
This is vb script so it needs to start with <% and end with %>. If not IIS will see it as some sort of html tags and will not process it correctly. You can also input this section right between the <head> and </head> tags.
Sorry my last response was incorrect, I didn't quite fully read through your code. If you are trying to add a code behind, you will input the tags at the very top of your page. As an example... <%@ Page Language='vb' AutoEventWireup='false' Codebehind='default.aspx.vb' Inherits='default'%>