示例#1
0
 public bool ProcessWebException(WebException ex)
 {
     this.challenge = LiveIdAuthentication.GetChallengeFromWebException(ex);
     if (String.IsNullOrEmpty(this.challenge))
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }
示例#2
0
        /// <summary>
        /// Executes an HTTP request ensuring login
        /// is done before the request is executed.
        /// If a WebException occurs containing a valid
        /// challenge, the request is attempted again.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="func"></param>
        /// <returns></returns>
        private T ExecuteRequest <T>(Func <T> func)
        {
            this.EnsureLogin();

            try
            {
                return(func());
            }
            catch (WebException ex)
            {
                this.challenge = LiveIdAuthentication.GetChallengeFromWebException(ex);
                if (String.IsNullOrEmpty(this.challenge))
                {
                    throw;
                }
            }

            return(func());
        }