I have an ActionResult method
where I query a database for products and if none are found, I redirect the user to the page /products/noproductsfound
.
noproductsfound
currently exists as a node in my backoffice and it has the Id of 1093
. Currently, I am just doing:
return RedirectToUmbracoPage(1093);
What happens if:
- The page (node) is deleted?
- What is the best way to store the node id to be used in RedirectToUmbracoPage? AppSettings?, etc
- Is this the proper way to redirect to another page? Why isn’t there an option to redirect with the name of a page instead?
- I tried doing return
View("NoProductsFound")
, but this is done after a post, so the view gets rendered, but stays on the same page, so a refresh keeps posting data. - If page nodes can be stored in AppSettings and the page is deleted and recreated assuming with a different Id, a non-technical person is not going to want to update AppSettings with the new Id, so how is this handled?
This is a companion discussion topic for the original entry at https://our.umbraco.com/forum/71344-best-practice-for-redirecting-to-umbraco-page