currently in our 7.5 project any request to a page that has been set to expired will be sent the login page. this is not great behaviour for a production system where by anyone with a bookmark etc to the expired content will get visibility to our login box.
how can we make sure these requests are sent to the 404 page. we are using mvc
You can override the AccessDenied() method in the template. This is preferably done in a base class.
public override void AccessDenied()
// Important! Do not access CurrentPage directly with an anonymous user, this will cause a loop
var currentPage = DataFactory.Instance.GetPage(this.CurrentPageLink);
&& (!currentPage.CheckPublishedStatus(PagePublishedStatus.Published) || currentPage.IsDeleted))
this.Response.Status = "404 Not Found";
this.Response.StatusCode = 404;
I'm having the same issue in EPiServer CMS 7.1. Can I trouble you to elaborate on your answer. Which class has the AccessDenied method?
In case anyone else having this problem finds this thread, here is a blog post offering another solution (putting code in the controller). http://www.epinova.no/blog/tarjei-olsen/dates/2012/12/handling-page-access-denied-scenarios-in-episerver-cms-7-mvc/
This bug have been fixed in latest versions (probably in 7.19)
I was facing this issue for disabled products (EPiserver Commerce) and those were fixed as private bugs
Bug #116989: Inconsistent behavior with unpublished content
Bug #117312: Inconsistent routing to unpublished content in MVC and web forms