You are missing the information in web.config
file found in the Views folder. In asp.net the configuration for a given folder will be resolved following this hierarchy of web.config
files:
machine.config -> root application web.config -> subdirectory web.config
In the case of asp mvc, the web.config file in the Views folder will configure the default namespaces to be included when compiling each view into its class and a default handler that prevents the view files from being directly accessed. See this question.
As you have created another directory SiteAViews in the root of your project (i.e. outside the Views folder), you are missing the basic mvc configuration that ~/Views/web.config
provides. You could fix it by copying ~/Views/web.config
into ~/SiteAViews/web.config
. (If you were using Razor you may want to copy the _ViewStart.cshtml file as well)
If you don´t like having to maintain 2 similar config files you will need to create a view folders hierarchy with a common root where you can put the web.config file (and adjust your view engine accordingly):
~/ViewLocations/web.config //common asp mvc views config
~/ViewLocations/Views/ //SiteB views
~/ViewLocations/SiteAViews/ //SiteA views
//In your view engine:
this.ViewLocationFormats = new string[8]
{
"~/ViewLocations/Views/{1}/{0}.aspx",
"~/ViewLocations/Views/{1}/{0}.ascx",
"~/ViewLocations/Views/Shared/{0}.aspx",
"~/ViewLocations/Views/Shared/{0}.ascx",
"~/ViewLocations/SiteAViews/{1}/{0}.aspx",
"~/ViewLocations/SiteAViews/{1}/{0}.ascx",
"~/ViewLocations/SiteAViews/Shared/{0}.aspx",
"~/ViewLocations/SiteAViews/Shared/{0}.ascx"
};
Hope it helps!