/// <summary>
 /// Initializes the default SharePointContextProvider instance.
 /// </summary>
 static SharePointContextProvider()
 {
     if (!TokenHelper.IsHighTrustApp())
     {
         SharePointContextProvider.current = new SharePointAcsContextProvider();
     }
     else
     {
         SharePointContextProvider.current = new SharePointHighTrustContextProvider();
     }
 }
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            if (filterContext == null)
            {
                throw new ArgumentNullException("filterContext");
            }
            Uri redirectUrl;

            switch (SharePointContextProvider.CheckRedirectionStatus(filterContext.HttpContext, out redirectUrl))
            {
            case RedirectionStatus.Ok:
                return;

            case RedirectionStatus.ShouldRedirect:
                filterContext.Result = new RedirectResult(redirectUrl.AbsoluteUri);
                break;

            case RedirectionStatus.CanNotRedirect:
                filterContext.Result = new ViewResult {
                    ViewName = "Error"
                };
                break;
            }
        }