Try our conversational search powered by Generative AI!

How do I determine if a user is in Edit Mode or Admin Mode?


In EPiServer 4.6x there was a method that would allow you to determine whether or not the user was viewing the page in Edit Mode or Admin Mode, which came in really useful for disabling third party analytics tools and so on if the user was viewing through Edit Mode.

I can't seem to find a similar method or way of determining this information in EPiServer 5 SP2, could somebody please let me know if they've achieved this?

Oct 23, 2008 16:34
You could check if the url you're currently browsing matches EPiServer.Configuration.Settings.Instance.UIUrl + "edit" or "admin" I don't think there's a methond for doing it automatically...
Oct 30, 2008 20:05

The URL you're currently browsing will never contain a mention of the UIUrl path, because that's only used for the pages that call the page being viewed.

You can compare against Request.UrlReferrer instead though, which does pretty much what I want to, apart from the scenario where you've just left edit mode by clicking the "View Mode" button, in this scenario you've got a referrer from the edit mode but you're not actually in edit mode anymore.

It'll do for now, though at some point perhaps EPiServer should consider reinstating the methods that were available in previous versions.

Nov 03, 2008 17:15
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.