I had asked about this before, and I cannot seem to locate my thread in the form. this is the code I was given to use for an admin check:
private bool IsPageInAdmin()
// will return TRUE is the page is viewed in administration part
if (this.Page.Request.RawUrl.IndexOf("cmspagemode=preview") > 0)
// will return TRUE is the page is in editing mode
if (this.Page.Request.RawUrl.IndexOf("cmspagemode=edit") > 0)
// the page is viewed in the public part.
hope this was helpful! by the way what happened to the code paster tool for this thing?