Use the IPageRouteHelper service and the Page property to get to the current page regardless of where your code is based. I suppose you can inject the service inside the constructor of the FormContainerBlockController ? If it's not allowed I would suggest to use the Injected<Service> property or ServiceLocator.Current.
Thanks Giuliano. That was one of the original methods I tried, but had no success. I gave it another look and it's still not working. Here's some notes on what I'm observing:
Maybe this is more of a feature request instead of a question, but... Is there a way we can redirect to the current page that the form is living on after the form in submitted?
I know if you don't specify the "Display page after submission", this is already done, but the functionality is client-side and doesn't actually trigger a page reload.
My use case for this is all revolving around personalization with visitor groups. Say I want to hide the form and show some other block when the form is submitted. I could do this after the form is submitted, but I need to manually refresh the page for it to happen. It would be nice if we can just redirect to the current page.
I've explored how this could be done, and the main Response.Redirect occurs on the FormContainerBlockController, which is easily extendable. What I can't figure out is how to get the actual current page, as the request context is within the form's controller. I've also looked into changing the redirectUrl value in the DataSubmissionService. So far, I'm coming up blank with a clean way to do this.