How can I find out through code if the current page is viewed by the user in edit or preview mode?
bool isInEditMode = PageEditing.PageIsInEditMode
PageEditing.PageIsInEditMode is for CMS7.
Check out this blog post for a CMS6 solution. http://www.christianengvall.se/check-page-episerver-opened-editadmin-mode/
Oops. I guess I should read which forum I'm on before replying :-)