I have multiple domain names, all pointing to the same wwwroot.
www.domain1.com
www.domain2.com
www.domain3.com
my folders look like this:
/domain1-folder
-->/domain2-folder
-->/domain3-folder
I use the global.asax as following:
protected void Application_BeginRequest(Object sender, EventArgs e) {
if (Request.Url.Host == "www.domain2.com") { Context.RewritePath("/domain2-folder/" + Request.Url.LocalPath); }
}
This way, when someone goto www.domain2.com, it retains the www.domain2.com url in the address bar, but it is actually browsing a folder inside the www.domain1.com (www.domain1.com/domain2-folder/).
The advantages are that I can have multiple website that are sharing the same MasterPage, class, etc.. making it easier to maintain.
Here is the issue : When browsing www.domain2.com or www.domain3.com it is VERY slow.
I know the cause is the global.asax. If I browse the domain2.com via www.domain1.com/domain2-folder/ it is going to be fast!
Any thought on what is causing this exactly? Is Application_BeginRequest the right event ?