Пример #1
0
        void browserControl_NavigationFailed(object sender, NavigationFailedEventArgs e)
        {
            WebBrowserNavigationException ex = e.Exception as WebBrowserNavigationException;
            uint error = ex != null ? (uint)ex.StatusCode : 0u;
            WebAuthenticationResult result = new WebAuthenticationResult("", WebAuthenticationStatus.ErrorHttp, error);

            WebAuthenticationResultSource.TrySetResult(result);
            e.Handled = true;
        }
Пример #2
0
 /// <summary>
 /// Handles the NavigationFailed event of the Browser control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="NavigationFailedEventArgs"/> instance containing the event data.</param>
 private void Browser_NavigationFailed(object sender, NavigationFailedEventArgs e)
 {
     if (this.ResultCode == AuthResultCode.Unknown)
     {
         WebBrowserNavigationException navException = e.Exception as WebBrowserNavigationException;
         if (navException != null && navException.StatusCode == HttpStatusCode.Unauthorized)
         {
             this.ResultCode = AuthResultCode.UnauthorizedClient;
         }
         else
         {
             this.ResultCode = AuthResultCode.ServerError;
         }
         this._authWaiter.Set();
     }
 }
Пример #3
0
        /// <summary>
        /// Handler for the browser control's navigation failed event.  We use this to detect errors
        /// </summary>
        private void BrowserControl_NavigationFailed(object sender, NavigationFailedEventArgs e)
        {
            WebBrowserNavigationException navEx = e.Exception as WebBrowserNavigationException;

            if (navEx != null)
            {
                // Pass along the provided error information.
                responseErrorDetail = (uint)navEx.StatusCode;
            }
            else
            {
                // No error information available.
                responseErrorDetail = 0;
            }
            responseStatus = WebAuthenticationStatus.ErrorHttp;

            authenticationFinished = true;
            e.Handled = true;

            // Navigate back now.
            browserControl.Source = new Uri("about:blank");
            NavigationService.GoBack();
        }
Пример #4
0
        /// <summary>
        /// Handler for the browser control's navigation failed event.  We use this to detect errors
        /// </summary>
        private void BrowserControl_NavigationFailed(object sender, NavigationFailedEventArgs e)
        {
            UnhookEvents();

            WebBrowserNavigationException navEx = e.Exception as WebBrowserNavigationException;

            if (navEx != null)
            {
                // Pass along the provided error information.
                responseErrorDetail = string.Format("Error code: {0}", navEx.StatusCode);
            }
            else
            {
                // No error information available.
                responseErrorDetail = NoDetailsAvailableMessage;
            }
            responseStatus = PhoneAuthenticationStatus.ErrorHttp;

            authenticationFinished = true;
            e.Handled = true;

            // Navigate back now.
            this.NavigateBackWithProgress();
        }