/// <summary>
 /// Initializes the default SharePointContextProvider instance.
 /// </summary>
 static SharePointContextProvider()
 {
     if (!TokenHelper.IsHighTrustApp())
     {
         SharePointContextProvider.current = new SharePointAcsContextProvider();
     }
     else
     {
         SharePointContextProvider.current = new SharePointHighTrustContextProvider();
     }
 }
예제 #2
0
        protected void Page_PreInit(object sender, EventArgs e)
        {
            Uri redirectUrl;

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

            case RedirectionStatus.ShouldRedirect:
                Response.Redirect(redirectUrl.AbsoluteUri, endResponse: true);
                break;

            case RedirectionStatus.CanNotRedirect:
                Response.Write("An error occurred while processing your request.");
                Response.End();
                break;
            }
        }
        /// <summary>
        /// Registers the specified SharePointContextProvider instance as current.
        /// It should be called by Application_Start() in Global.asax.
        /// </summary>
        /// <param name="provider">The SharePointContextProvider to be set as current.</param>
        public static void Register(SharePointContextProvider provider)
        {
            if (provider == null)
            {
                throw new ArgumentNullException("provider");
            }

            SharePointContextProvider.current = provider;
        }
 /// <summary>
 /// Initializes the default SharePointContextProvider instance.
 /// </summary>
 static SharePointContextProvider()
 {
     if (!TokenHelper.IsHighTrustApp())
     {
         SharePointContextProvider.current = new SharePointAcsContextProvider();
     }
     else
     {
         SharePointContextProvider.current = new SharePointHighTrustContextProvider();
     }
 }