In .Net MVC there is an attribute ChildActionOnly
that ensures a particular action cannot be retrieved via a GET request directly, and can only be rendered by way of returning a Partial View from another action or view. (see: Using ChildActionOnly in MVC)
If the user attempts to navigate to an action marked as ChildActionOnly
they will see the following error:
The action 'actionName' is accessible only by a child request.
Is there a way of detecting this and redirecting to the main page that calls the child action, or redirect to another page to make sure this error doesn't appear and any accidental requests by the user are handled appropriately?