/// <summary>
        /// if login failed, re-navigate to the target Uri, otherwise, show status detail of you.
        /// </summary>
        /// <param name="htmlContent">html of websites</param>
        private void CheckIfLoginSucceed(LoginReturnBag loginReturn)
        {
            var doc = new HtmlDocument();

            if (loginReturn.HtmlResouces == null)  // login failed, redirect to the login page.
            {
                ReportHelper.ReportAttention(GetUIString("Login_Failed"));
                SettingsHelper.SaveSettingsValue(SettingsSelect.IsAutoLogin, false);
                RedirectToLoginAgain();
                return;
            }
            doc.LoadHtml(loginReturn.HtmlResouces);
            var rootNode      = doc.DocumentNode;
            var studentStatus = rootNode.SelectSingleNode("//span[@class='t']");

            if (studentStatus == null)   // login failed, redirect to the login page.
            {
                ReportHelper.ReportAttention(GetUIString("Login_Failed"));
                SettingsHelper.SaveSettingsValue(SettingsSelect.IsAutoLogin, false);
                RedirectToLoginAgain();
                return;
            }
            else     // login successful, save login status and show it.
            {
                if (!studentStatus.InnerText.Contains("请先登录再使用"))
                {
                    SaveLoginStatus(studentStatus, loginReturn.CookieBag);
                    LoginPopup.IsOpen = false;
                    SetVisibility(MainPopupGrid, false);
                    if (thisPageType == DataFetchType.Index_ReLogin)
                    {
                        RedirectToPageBefore();
                        return;
                    }
                    SetVisibility(StatusGrid, true);
                }
                else
                {
                    ReportHelper.ReportAttention(GetUIString("Login_Failed"));
                    SettingsHelper.SaveSettingsValue(SettingsSelect.IsAutoLogin, false);
                    RedirectToLoginAgain();
                    return;
                }
            }
        }
        /// <summary>
        /// Login into LNU, should only call it when login-cookie is gone.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="user"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        public static async Task <LoginReturnBag> PostLNULoginCallback(HttpClient client, string user, string password)
        {
            /// Changes for Windows Store

            //var urlString = string.Format("http://jwgl.lnu.edu.cn/pls/wwwbks/bks_login2.login?stuid={0}&pwd={1}", user, password);

            var urlString = string.Format("https://notificationhubforuwp.azurewebsites.net/LNU/Redirect?user={0}&psw={1}", user, password);
            var bag       = new LoginReturnBag();

            try { // do not dispose, so that the global undirect httpclient will stay in referenced. dispose it when you need.
                var httpClient = client;

                //httpClient.DefaultRequestHeaders.Host = new Windows.Networking.HostName("jwgl.lnu.edu.cn");
                //httpClient.DefaultRequestHeaders.Referer = new Uri("http://jwgl.lnu.edu.cn/zhxt_bks/xk_login.html");

                ///

                using (var response = await LOGIN_POST(client, urlString)) {
                    var returnCookies = UnRedirectCookiesManager.GetCookies(new Uri("https://notificationhubforuwp.azurewebsites.net/"));
                    if (returnCookies.Count == 0)
                    {
                        throw new AccessUnPassedException("Login Failed: no login-success cookie received.");
                    }

                    /// Changes for Windows Store

                    string content = default(string);
                    var    value   = response.Headers.TryGetValue("Set-Cookie", out content);
                    if (value)
                    {
                        content = content.Split(',')[0].Replace(";", "@").Split('@')[0].Replace("=", "@").Split('@')[1];
                        HttpCookie cookie = new HttpCookie("ACCOUNT", "jwgl.lnu.edu.cn", "/pls/wwwbks/");
                        cookie.Value = content;

                        /// DEBUG Method

                        Debug.WriteLine("DEBUG ----->   " + content);

                        ///

                        UnRedirectCookiesManager.SetCookie(cookie);
                        bag.CookieBag = cookie;
                    }

                    ///

                    using (var request = GET(client, "http://jwgl.lnu.edu.cn/pls/wwwbks/bks_login2.loginmessage")) {
                        request.Headers.Host    = new Windows.Networking.HostName("jwgl.lnu.edu.cn");
                        request.Headers.Referer = new Uri("http://jwgl.lnu.edu.cn/zhxt_bks/xk_login.html");
                        var result = await httpClient.SendRequestAsync(request);

                        bag.HtmlResouces = (await CastStreamContentToString(result)).ToString();
                    }
                }
            } catch (ObjectDisposedException ex) { // when web connect recovery , recreate a new instance to implemente a recursive function to solve the problem.
                Debug.WriteLine("\nFailed:\n" + ex.StackTrace);
                unRedirectHttpClient = null;
                return(await PostLNULoginCallback(UnRedirectHttpClient, user, password));
            } catch (COMException ex) { // it is obvious that the internrt connect go wrong.
                Debug.WriteLine("\nFailed:\n" + ex.StackTrace);
                return(null);
            } catch (AccessUnPassedException ex) {
                Debug.WriteLine("\nFailed:\n" + ex.StackTrace);
                unRedirectHttpClient = null;
                return(bag);
            } catch (Exception ex) { // unkown error, report it.
                Debug.WriteLine("\nFailed:\n" + ex.StackTrace);
                return(null);
            }
            return(bag);
        }
 /// <summary>
 /// if login failed, re-navigate to the target Uri, otherwise, show status detail of you.
 /// </summary>
 /// <param name="htmlContent">html of websites</param>
 private void CheckIfLoginSucceed(LoginReturnBag loginReturn)
 {
 }