I have a sublayout/rendering that lives on a wildcard item within the content tree. For example, at /sitecore/content/home/news/news-features/*/*/*/*
.
The sublayout/rendering checks an external data source to determine if content should be returned and does so if it can find it. However, if the content is not found for the path I would like to trigger our normal 404, which we've set up via the ItemNotFoundUrl
Sitecore config setting.
Right now the control is simply doing a Response.Redirect("/not-found", true);
if content for the request cannot be found, but I'm wondering instead if an exception can be thrown, or the item not found pipeline/processor can otherwise be triggered.
Can a sublayout/rendering trigger the item not found pipeline, such as when wildcard paths are used? Or is redirecting the best practice?