ASP.NET Membership change password not working

前端 未结 10 1904
心在旅途
心在旅途 2021-02-19 18:48

I have this code for changing a user\'s password when they click the password reset button (with extra code to log to ELMAH so I can try to figure out what is going wrong).

10条回答
  •  南方客
    南方客 (楼主)
    2021-02-19 19:24

    Could your main catch block be throwing an exception itself that you haven't noticed?

    catch (Exception ex)
    {
        ErrorSignal.FromCurrentContext().Raise(new Exception("ResetPassword: " + ex));
        return Json(new { Error = ex.Message + " -> " 
                + ex.InnerException.Message }, JsonRequestBehavior.AllowGet);
    }
    

    The ex.InnerException.Message statement is not safe because it could throw a NullReferenceException.

提交回复
热议问题