sorry that was a copy in mid testing, I had already done as in your example, no dice.
I have started using a surface controller (so the route is actually registered) for now but would still like to get a proper controller that is not using all of the Umbraco overhead.
I have usually routed controllers through Umbraco as I've usually needed something from Umbraco on the model, and most examples are geared towards doing that - but what you are describing is having like an MVC app work alongside Umbraco - which in V7 was totally possible by just adding the custom route and using Umbraco.Core.ReservedPaths/ReservedUrls appsetting to tell Umbraco to leave well alone.
I suspect in .net core this is a bit different, and I've not done it before so this is all a guess.
It looks like it's still possible to specify ReservedPaths and ReservedUrls -
but if you are attempting to map the route to a controller completely outside of Umbraco, what I'd expect from my guess that if it routes correctly this setting won't come in to play.
Yeah this process is what I tested, it's weird the docs say it should work, yet it doesn't, maybe I have to add the path to the reserved paths or something.
Umbraco 10 - Need to create normal MVC controller + Route + views
I am upgrading an older site and cannot get a custom mvc controller to work.
This controller uses views that are not umbraco nodes (although I may want to grab some data from Umbraco content)
The documentation merely goes through some methods to get data externally and put it on an Umbraco content node view.
None of the examples of routing to the controller seem to work, all resulting in a 404 page.
^ does not fire a controller called TestNewController or the index method.
What would be the best way of implementing this bearing in mind the views I would need to get are not umbraco views.
Any help or a small example appreciated.
I believe the error is here. You are setting the Controller as Index
try this
sorry that was a copy in mid testing, I had already done as in your example, no dice.
I have started using a surface controller (so the route is actually registered) for now but would still like to get a proper controller that is not using all of the Umbraco overhead.
Hi Damien
I have usually routed controllers through Umbraco as I've usually needed something from Umbraco on the model, and most examples are geared towards doing that - but what you are describing is having like an MVC app work alongside Umbraco - which in V7 was totally possible by just adding the custom route and using Umbraco.Core.ReservedPaths/ReservedUrls appsetting to tell Umbraco to leave well alone.
I suspect in .net core this is a bit different, and I've not done it before so this is all a guess.
It looks like it's still possible to specify ReservedPaths and ReservedUrls -
in appsettings.json
And it 'looks like' it's possible to register an MVC route endpoint outside of Umbraco in startup.cs
I'd put it below and outside the UseUmbraco stuff
And then that controller can 'just' inherit from Controller - No Umbraco stuff.
and a request to /SuperTest/index should just work?
When looking at the source, I did see this new setting called TryMatchingEndpointsForAllPages - which by default is set to false.
https://docs.umbraco.com/umbraco-cms/reference/configuration/webroutingsettings#try-matching-endpoints-for-all-pages
but if you are attempting to map the route to a controller completely outside of Umbraco, what I'd expect from my guess that if it routes correctly this setting won't come in to play.
regards
Marc
Yeah this process is what I tested, it's weird the docs say it should work, yet it doesn't, maybe I have to add the path to the reserved paths or something.
Hi Damien
From your screenshot, it looks like you have called
Eg calling the extension method on 'u' which is within
app.UseUmbraco().WithEndponts(u=>
...
But my suggestion is to call it 'after' the Umbraco stuff, directly on app.
It worked for me locally. (I didn't need to add as a reserved path or send the trymatchingendpoints setting)
I was going to update the docs so that it reflected this subtlety - but are you saying you've tried this and it didn't work???
regards
marc
Yeah doing that did not work either, never found a solution that actually worked on that version, haven't tried doing this for any since.
is working on a reply...