0

我对AngularJS相当陌生,我有一个函数返回“尝试了太多自动重定向。我在应用程序端运行Ionic和AngularJS,在服务器端运行C#。我没有创建C#服务器端,所以我不知道从哪里开始寻找错误。我的问题是我应该寻找什么特定的东西?什么会导致这个错误显示?这是在服务器端还是客户端?

var forgotPassword = ForgotPassword.save({email:resp}).$promise.then(
        function Success(sucresp) {
          console.log("This returned with: " + sucresp)
          if (sucresp.ForgotPasswordResult.IsSuccess == true) {
              $ionicPopup.alert({
                    title: "Password Changed",
                    template: sucresp.ForgotPasswordResult.ErrorMessage
                });
          } else {
              $ionicPopup.alert({
                    title: "Password Was Not Changed",
                    template: sucresp.ForgotPasswordResult.ErrorMessage
                });
          }
        },
        function Failed(erresp){

          console.log("This failed like your life, now start crying: " + erresp)
          $ionicPopup.alert({
                    title: "Error Messge",
                    template: erresp
                });
        }
      ); 

服务器端是。

public ForgotPasswordResponse ForgotPassword(string email)
    {
        ForgotPasswordResponse resp = new ForgotPasswordResponse();
        resp.IsSuccess = false;

        string emailAddress = email;

        System.Security.Cryptography.RandomNumberGenerator randGen = System.Security.Cryptography.RandomNumberGenerator.Create();
        byte[] bytes = new byte[6];
        randGen.GetNonZeroBytes(bytes);
        string newPassword = Convert.ToBase64String(bytes);
        newPassword = Regex.Replace(newPassword, "[^a-zA-Z0-9]+", "", RegexOptions.Compiled);

        bool resetPasswordResult = false;
        try
        {
            string emailBody = string.Format(@"Your ****.com password has been reset.

The new password is {0}

Go to https://****.com/Login/login.aspx to login to the web site.

It is recommended that you change your password as soon as possible.

This message was sent from an automated system.  Please do not reply to it.", newPassword);

            Email.SendAmazonSES(emailAddress, "password reset", emailBody);
            resetPasswordResult = ResetPassword(emailAddress, newPassword);

            if (resetPasswordResult == false)
            {
                throw new Exception("The user account does not exist.");
            }

            resp.IsSuccess = true;
            resp.ErrorMessage = "Your password has been reset.  Check your email for the new password.";
        }
        catch (Exception ex)
        {
            resp.IsSuccess = false;
            resp.ErrorMessage = ex.Message;
            return resp;
        }

        return resp;
    }
4

1 回答 1

0

这样做的原因是一页从一页转到另一页,然后又回到第一页。它正在将它从一个页面重定向到另一个页面并最终超时。

于 2016-05-23T14:10:16.600 回答