kgiszewski/LearnUmbraco7

Clarify Surface Controller Routing Mechanisms

Closed this issue · 7 comments

You have a page on surface controllers here: https://github.com/kgiszewski/LearnUmbraco7/blob/master/Chapter%2006%20-%20Surface,%20WebAPI%20and%20RenderMVC%20Controllers/02%20-%20Surface%20Controllers.md

Something that can confuse people who know MVC is that surface controllers can use a hidden input field with a name of "ufprt" to perform some routing (rather than use the URL). You can see that in action here: https://github.com/umbraco/Umbraco-CMS/blob/release-7.3.4/src/Umbraco.Web/Mvc/RenderRouteHandler.cs#L138

Basically, that value contains the controller/action (and some other route info) and Umbraco routes using that data rather than the URL (though, it seems a particular URL also does work).

Since this may trip up many people, including those already familiar with MVC (it tripped me up for a while), it seems like it would definitely be worth clarifying in your GitHub repo.

I think the "ufprt" value may also contain the current page ID, but I need to research that a bit more to confirm.

If I can find some time, I'll submit a pull request eventually for this. However, if you want to write this documentation in the meantime, feel free :-)

@Nicholas-Westby,

Thanks for this. If you want to tackle this, please do as I'd have very little context to give the write up :)

@kgiszewski Do you mind assigning this to me?

Note to self: "ufprt" seems to stand for "Umbraco Form Post RouTe".

Seems I can't since this is a personal account without giving you full admin access.

Gotcha. Thanks for trying.

Just a friendly reminder that this is done and merged into the develop branch, but hasn't been merged into the master branch yet. It's been a few months, so thought I'd poke you :-)

commits

Oh wow I didn't notice. Totally my fault. I assumed they came in on Master 😬

All merged now 👍

Sweetness! 👍