Created
January 22, 2018 20:16
-
-
Save hermanussen/510223292b2971a659b8d26f7c7bd4f5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Optional: uncomment whichever ways you feel are appropriate for security | |
// Ensure that your monitoring tool matches these | |
if (!(true | |
//&& Request.IsSecureConnection // Checks if using HTTPS | |
//&& Request.QueryString["authkey"] == @"secret" | |
&& Request.UserHostAddress == "127.0.0.1" | |
//&& Sitecore.Context.IsLoggedIn | |
//&& Sitecore.Context.IsAdministrator | |
//&& Sitecore.Context.User.IsInRole(@"sitecore\Developer") | |
)) | |
{ | |
Response.StatusCode = (int)System.Net.HttpStatusCode.Forbidden; | |
Response.Write("You are not authorized to view this page"); | |
Response.TrySkipIisCustomErrors = true; | |
Response.End(); | |
return; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment