I have some code in a request handler that I only want to run on the LIVE site, not the ADMIN site. I check "SiteContext.CurrentSiteName" to make sure it's set to "my_site_name". And I check CMS.PortalEngine.PortalContent.ViewMode to make sure it's set to "LiveSite"
But the code is still running for some admin pages. I printed a message to the event log to test this, and sure enough ViewMode and CurrentSiteName are set to "LiveSite" and "my_site_name" on some of the admin pages.
Is there anything else I can check to see if I'm on an admin page?
Maybe the easiest way is to check whether the url starts with /Admin after your domain name (and virtual folder).
Please, sign in to be able to submit a new answer.