Skip to content

Instantly share code, notes, and snippets.

@crilleengvall
Created September 11, 2012 09:03
Show Gist options
  • Save crilleengvall/3697074 to your computer and use it in GitHub Desktop.
Save crilleengvall/3697074 to your computer and use it in GitHub Desktop.
Check if page in episerver is opened in editmode/adminmode
private bool IsOpenedInEditMode()
{
bool isInEditMode = false;
If(HttpContext.Current.Request.UrlReferrer != null)
{
isInEditMode = Regex.IsMatch(HttpContext.Current.Request.UrlReferrer.LocalPath, "/admin/|/edit/", RegexOptions.IgnoreCase);
}
return isInEditMode;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment