I've got a web API using ASP.NET MVC in the final stages before deployment. I had created 2 pages that were linked to in the _Layout.cshtml such as:

  • @Html.ActionLink("API", "Index", "Help", new { area = "" }, null)
  • These two added pages were used for development to edit an entity DB. I do not want these pages to be accessible in the deployed version for anyone to mess with.

    I've hid the two pages along with the help documentation from the home menu by commenting out the respective lines shown above. However a direct link to the page still works. Is there any easy way to turn these pages off, or return a bad request if someone attempts to go to them, without deleting the code entirely? They will definitely be useful at some later time, I'd just prefer a way to temporarily enable/disable them besides just simply hiding the links.

    Related posts

    Recent Viewed