We enabled localization for one of the publications and we can see all the Tridion pages in our website. But when we try to access any custom controllers or DXA controllers, we get 404 error.
The entries in Global.asax for enabling the Controllers are in this format:
routes.MapRoute(
"Core_Admin",
"admin/{action}",
new { controller = "Admin", action = "Refresh" }
);
routes.MapRoute(
"Core_Admin_Loc",
"{localization}/admin/{action}",
new { controller = "Admin", action = "Refresh" }
);
Please note that this code works for a site which has no localization set. So it seems to be an issue in the {localization} field of the route mapping.
The localization information set in Topology manager is:
CmEnvironmentId : Tridion_cm_*****
PublicationId : tcm:0-91-1
EnvironmentPurpose : Staging
WebApplicationId : ****Website_RootWebApp
RelativeUrl : /
PrimaryMappedUrl : http://dev.*****.com/en/us/
IsOffline : False
CdEnvironment :
Id : ****WebsiteMappingENUS
ExtensionProperties : {}
ContextUrl : /en/us
WebsiteId : ***Website
EnvironmentPurpose : Staging
CdEnvironment :
ScopedRepositoryKeys : {}
Id : ****Website_RootWebApp
ExtensionProperties : {}
BaseUrls : {http://dev.****.com, http://localhost:***}
CdEnvironmentId : CdEnvironment1
EnvironmentPurpose : Staging
CdEnvironment :
ScopedRepositoryKeys : {}
Id : ****Website
In Global.asax, if we replace the text {localization} with en/us/, the controller works.
Any help is appreciated.
Edit 1:
Updated the site localization information in Topology Manager to:
CmEnvironmentId : Tridion_cm_******
PublicationId : tcm:0-91-1
EnvironmentPurpose : Staging
WebApplicationId : ****Website_RootWebApp
RelativeUrl : /en/us
PrimaryMappedUrl : http://dev.****.com/en/us
IsOffline : False
CdEnvironment :
Id : ****WebsiteMappingENUS
ExtensionProperties : {}
ContextUrl : /
WebsiteId : ***Website
EnvironmentPurpose : Staging
CdEnvironment :
ScopedRepositoryKeys : {}
Id : ****Website_RootWebApp
ExtensionProperties : {}
Still getting the same error.
{loc1}/{loc2}/whatever
? Maybe ASP.NET MVC doesn’t like a URL path variable with a slash in it.