I am using .NET Core MVC to prevent users from navigating to an action by manually entering the URL into their browser.
In previous versions of MVC the following code snippet would do the trick:
public ActionResult Index()
{
if(!ControllerContext.IsChildAction)
{
// redirect to different action
}
return View(viewModel);
}
Source (also similar question)
How could I accomplish this using .NET Core MVC?