Hello, I'm new to Umbraco and there are some concerns I'm having about best practices when developing using Umbraco.
The main concern is when using SurfaceController, as far as I have seen most code samples found on the net.
I 'm not comfortable with the views/pages executing before the controller actions and having to invoke the controller's actions from within the views.
I'd like to know if that is the correct way to work with Umbraco, or if there is a better way to do it and keeping the default MVC behavior of executing the controller's actions first and then return to the page, avoiding having to have execution code on the views.
Some reasons for this may be: to control exactly how views are
rendered, custom/granular security for certain pages/templates or to
be able to execute any custom code in the controller that renders the
front end.
Umbraco best practices
Hello, I'm new to Umbraco and there are some concerns I'm having about best practices when developing using Umbraco.
The main concern is when using SurfaceController, as far as I have seen most code samples found on the net.
I 'm not comfortable with the views/pages executing before the controller actions and having to invoke the controller's actions from within the views.
I'd like to know if that is the correct way to work with Umbraco, or if there is a better way to do it and keeping the default MVC behavior of executing the controller's actions first and then return to the page, avoiding having to have execution code on the views.
Thanks.
You are probobly interested in Custom controllers: https://our.umbraco.org/documentation/reference/routing/custom-controllers
Hi Eduardo,
Welcome to Our Umbraco Forum
I would say that the best way to use SurfaceControllers - handling notAjax forms.
In all other ways is better to use UmbracoApiController or just Templates.
Can you provide more information what do you want to do with SurfaceControllers ?
Thanks, Alex
is working on a reply...