I need to patch in a fix for a bug with Sitecore MVC Caching (confirmed by support).

The pipeline I need to patch into is:

I need to set cache settings on the page object, e.g:


However to do that I need access to the System.Web.UI.Page.

Whatever I try the page is coming up null:

PageContext page = Context.Page;
Page page = HttpContext.Current.Handler as Page;
Page page = Sc.Context.Page.Page;

I know I can use:

Page page = PageContext.CurrentOrNull.Item;

To get the Sitecore page item but I need the System.Web.UI.Page, not the item.

I'm guessing this is due to the order in which the MVC Pipelines run etc: http://jockstothecore.com/sitecore-mvc-item-maze/

Any help would be appreciated.

Other info: Sitecore 8.1 Update 2, MVC

  • Makes no sense to me. System.Web.UI.Page is the class you inherit in an .aspx file, e.g. a Webforms layout. It would not come into play in MVC.
    – Mark Cassidy
    Commented Sep 7, 2017 at 16:21
  • 1
    Ahr yes your right Mark, I'm being a bit of an idiot. I've got it working now, just needs to be HttpContext.Current.Response.Cache.SetNoStore(); Commented Sep 7, 2017 at 16:34

1 Answer 1


As mentioned in the comments I was going about this in the wrong way for MVC. This is the solution for my pipeline:

public override void Process(GetPageRenderingArgs args)
            Assert.ArgumentNotNull((object)args, "args");
            Profiler.StartOperation("Update browser caching headers.");
            HttpContext currentContext = HttpContext.Current;
            Item currentItem = PageContext.CurrentOrNull.Item;

            if (currentContext == null)


            if (currentItem != null)
                MvcBrowserCaching.SetUpdateHeaders(currentItem, currentContext);


I can then set the cache like so:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.