3

I have a sublayout in my Sitecore site which is used to perform a redirect via a meta-refresh (a temporary measure) however I'd like editors to be able to preview the page without the redirect happening. Is there a way in the Page_Load method to check, using the Sitecore API, if the page is being previewed?

1 Answer 1

9

Yes, check the page mode. Assuming you can move the meta-refresh to a redirect you can do this:

    protected void Page_Load(object sender, EventArgs e)
    {
        if(!Sitecore.Context.PageMode.IsPreview)
        {
            // Not in preview mode
            Response.Redirect("redirectionurl.aspx");
        }
    }

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.