I'm working on a full MVC project that contains both Umbraco CMSed Views and non CMSed views.
My route handing is currently like this.
public class MyStartupHandler : IApplicationEventHandler
{
public void OnApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
RegisterRoutes(RouteTable.Routes);
}
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "\\", action = "Index", id = UrlParameter.Optional }
);
}
public void OnApplicationInitialized(
UmbracoApplicationBase umbracoApplication,
ApplicationContext applicationContext)
{
}
public void OnApplicationStarting(
UmbracoApplicationBase umbracoApplication,
ApplicationContext applicationContext)
{
}
}
When i try to load the an Umbraco page. Current-Page is null or the views dont load leaving the pages blank.
When i remove the the code inside the Register Routes umbraco views load fine but the Controllers (not Surface Controllers) don't work. and non Umbraco views don't load
Looking for a way that will allow me to use Controllers to load views and Load the umbraco pages.
If I'm not mistaken, you've taken over all URLs from Umbraco for the three first levels in your content-tree.
If you prefix your route url with "myapplication" for instance, you should start getting content again. Although, you can't of course make a content node called "myapplication".
Route Handling
I'm working on a full MVC project that contains both Umbraco CMSed Views and non CMSed views.
My route handing is currently like this.
When i try to load the an Umbraco page. Current-Page is null or the views dont load leaving the pages blank. When i remove the the code inside the Register Routes umbraco views load fine but the Controllers (not Surface Controllers) don't work. and non Umbraco views don't load
Looking for a way that will allow me to use Controllers to load views and Load the umbraco pages.
If I'm not mistaken, you've taken over all URLs from Umbraco for the three first levels in your content-tree.
If you prefix your route url with "myapplication" for instance, you should start getting content again. Although, you can't of course make a content node called "myapplication".
This is all documented fairly well over here.
Thank you i will read the documentation.
is working on a reply...