I am trying to map the subdomains to areas, So far all the answers I found were for pervious versions of .NET and not .NET core. the best and most relevant answer I found was from This page. however i am having a problem implementing it as it appears to be the walkthrough for a pervious version of .NET core and i am getting the 'MvcRouteHandler' does not contain a constructor that takes 0 arguments
Error.
Here is the code which i get the error from:
public class AreaRouter : MvcRouteHandler, IRouter //the error happens in this line, visual studio underlines the AreaRoute word
{
public new async Task RouteAsync(RouteContext context)
{
string url = context.HttpContext.Request.Headers["HOST"];
string firstDomain = url.Split('.')[0];
string subDomain = char.ToUpper(firstDomain[0]) + firstDomain.Substring(1);
string area = subDomain;
context.RouteData.Values.Add("area", subDomain);
await base.RouteAsync(context);
}
}
so anyway, i am looking for another way to map subdomains to areas or find a way to fix this error.