I have already read this thread: http://world.episerver.com/Modules/Forum/Pages/thread.aspx?id=15953 which suggests either using the "idkeep" querystring parameter.
I'm getting partial success with but when I publish a page with "Composer - Edit On Page" the idkeep querystring parameter is still on the URL.
Is there a recommended way to tell whether you are in an editing interface (Composer/Standard UI) aside from the one I'm trying above?
This is one way
public static bool IsEditOrPreviewMode
HttpRequest request = HttpContext.Current.Request;
Uri referrer = request.UrlReferrer;
return referrer != null &&
referrer.Host == request.Url.Host &&
Thanks for the reply. This works for the regular editor but not "Composer - Edit on page".
Are there any more alternatives? Should I have posted this in the Composer section?
The Composer ExtensionHandler has a property called ViewMode that you can look at.
Eg: if (_extensionHandler.ViewMode == ExtensionGeneric.ViewMode.ExtensionEditOnPageMode || _extensionHandler.ViewMode == ExtensionGeneric.ViewMode.ExtensionEditMode)
If using composer why not use Dropit.Extension.Core.BaseContentFunction.IsEditMode
Hi Frederik, Thanks for your tip. How would I get the value of _extensionHandler on a masterpage?
Minesh, Thanks for reply. I know this method works in a composer function, but only if it is registered. I'd ideally like to implement this on a masterpage without registering a composer function I have no plans to use.
I have it in a base class for my Composer page types:
public abstract class ComposerPageBase<T> : TemplatePageBase<T> where T : TypedPageData
//Add a ExtensionPageHandler to enable Composer
private Dropit.Extension.Core.ExtensionPageHandler _extensionHandler;
_extensionHandler = new ExtensionPageHandler();
protected override void OnInit(EventArgs e)
// Add meta tag to set default content compatible mode in IE 8
HtmlMeta httpEquiv = new HtmlMeta();
httpEquiv.HttpEquiv = "X-UA-Compatible";
httpEquiv.Content = "IE=EmulateIE7";
//It's important that _extensionHandler initialized after base.OnInit.
if (_extensionHandler.ViewMode == ExtensionGeneric.ViewMode.ExtensionEditOnPageMode || _extensionHandler.ViewMode == ExtensionGeneric.ViewMode.ExtensionEditMode)
ahh i see. that works great, thanks for the help. the amusing thing is that i'm using it to set the same meta tag you have in your code snippet above!