Try our conversational search powered by Generative AI!

Detect which window makeing request in editmode

Vote:
 

Hello

In episerver edit mode there are a couple of frames i.e menu tree-frame, top-frame and content-frame where the actual page beeing edited is rendered.

I have to have different MasterPages based on a settings om current page being rendered and that is detected in a httmodule and masterpage is switched based on setting.... Everything works fine but not in edit mode because when masterpage is switched there will be a runtime error in edit mode.... My thought is now to just switch masterpage for page beeing rendered in content-frame so is there a way to detect which frame rendering page?

Thanks in advance!

#69121
Mar 22, 2013 10:38
Vote:
 

Perhaps you can use this to check if you are in edit mode?

        private bool IsEditOrPreviewMode()
        {
            HttpRequest request = HttpContext.Current.Request;
            Uri referrer = request.UrlReferrer;

            return referrer != null &&
                   referrer.Host == request.Url.Host &&
                   referrer.Segments[referrer.Segments.Length - 1]
                       .Equals("EditPanel.aspx", StringComparison.InvariantCultureIgnoreCase);
        }

    

#69134
Mar 22, 2013 11:59
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* 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.