SaaS CMS has officially launched! Learn more now.

Inaactive Pages



I'm looking into an issue we're having with Episerver. I'd like the ability to take web pages in Episerver that have been published, and disable it so if a customer browses to this page, they'll receive a 404 error. If I expire this page, or I change the rights to this page to only have administrators and browse to the page, than we don't get a 404 page, we get an Episerver log in prompt. Is there any way to like archive a page, or set a page as inactive?

Help with this would be greatly appreciated.


Oct 26, 2015 19:58
Edited, Oct 26, 2015 20:48

I even commented on that thread also :)

Oct 26, 2015 20:57

You are everywhere!;-)

Oct 26, 2015 21:13

I had seen this link before but wanted to reach out to you guys to see if there was anything less kludge. Seems like this is the only answer, which I find odd because you’d think that disabling a page that has already been published would be very basic functionality and shouldn’t require us to expire it / write code to override the default behavior. Is this a request we can put in for the next version?

Anyway, I did want to thank you guys the quick response. I did try to go ahead and implement your method however, one issue I’m running in to is that we are using Episerver 8 with MVC, and our page types don’t inherit from PageBase. They do inherit from SitePageData and maybe I’m missing something, but I don’t see any methods in this class, or any classes that this enherits from called AccessDenied.


Oct 26, 2015 21:33

While running on Mvc, I would look for ActionFilters and execute code fragment mentioned above before action executing event to catch and inspect requested page, and if needed redirect to 404 or something. Just remember - it's wise to do so only in "visitor mode" -> when somebody is browsing you site. Probably editors will still need to access that page, even it's "inactive". You can check this using PageEditing.IsInEditMode or similar (writting from top of my head)..

Oct 26, 2015 21:45

Thanks, i'll look in to this as a possible direction. 


Oct 26, 2015 21:53

Hi Paul,

You can create an action filter as Valdis suggested, or override OnAuthorization method in your base controller:

protected override void OnAuthorization(AuthorizationContext filterContext)
    // don't throw 404 in edit mode
    if (!PageEditing.PageIsInEditMode)
        if (PageContext.Page.StopPublish <= DateTime.Now)
            filterContext.Result = new HttpStatusCodeResult(404, "Not found");


Hope this helps!

Oct 27, 2015 12:04

This is literally exactly what I needed. Thanks!

Oct 27, 2015 14:19

For future reference, Dejan has blogged about it here:

Several solutions for different scenarios.

Edited, Oct 29, 2015 8:48
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.