I read: http://support.discountasp.net/KB/a369/how-to-redirect-a-subdomain-to-a-subdirectory.aspx but it was not very helpful, for my issue. I wasnt sure where to place the code so I did the same thing but in the Global.asax. So in the Global.asax I put this code to handle subdomains void Application_BeginRequest(Object sender, EventArgs e) { if (Request.ServerVariables["SERVER_NAME"].ToLower() == "mysub.mysite.com") { Server.Transfer("test.htm", true); } } I get this as the address: res://ieframe.dll/dnserrordiagoff.htm#http://mysub.mysite.com/ Any ideas on how to resolve this? Thanks
First, things to note about the subdomain addon: http://mysub.mysite.com!= http://www.mysite.com/mysub http://mysub.mysite.com== http://www.mysite.com http://mysub.mysite.com/mysub == http://www.mysite.com/mysub The code in the knowledgebase article was meant to be put in the default document page in the root. You should avoid using Server.Transfer in the Application_BeginRequest because it causes problems. To do redirects in the global.asax, try this instead: void Application_BeginRequest(Object sender, EventArgs e) { if (Request.ServerVariables["SERVER_NAME"].ToLower() == "mysub.mysite.com") { string redirectUrl = String.Format("/{0}{1}", "mysub", Request.RawUrl); this.Context.RewritePath(redirectUrl); } } This means that whatever path after the mysub.mysite.com domain will have an internal path of /mysub/whatever. The result: http://mysub.mysite.com/helloworld.apx(browser URL)= http://mysub.mysite.com/mysub/helloworld.aspx(internally) Aristotle DiscountASP.NET www.DiscountASP.NET