电子邮件注册C#不会注册,但会发送电子邮件

时间:2017-06-29 20:30:38

标签: c# asp.net

在我添加发送电子邮件的方法之前,我的注册页面工作正常。之后,我可以按下注册按钮来创建新用户,但即使发送了电子邮件,也不会再保存详细信息。为什么不保存?我正在放置两种保存和发送电子邮件的方法:

<script src="https://code.jquery.com/jquery-3.1.0.js"></script>
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.15/css/jquery.dataTables.min.css" />
<script src="https://cdn.datatables.net/1.10.15/js/jquery.dataTables.min.js"></script>
<h1>Success</h1>
<table id="example">
  <thead>
    <tr>
      <th>Col 1</th>
      <th>Col 2</th>
      <th>Col 3</th>
    </tr>
  </thead>
  <tbody>
  </tbody>
</table>
<h1>Error</h1>
<table id="example2">
  <thead>
    <tr>
      <th>Col 1</th>
      <th>Col 2</th>
      <th>Col 3</th>
    </tr>
  </thead>
  <tbody>
  </tbody>
</table>

1 个答案:

答案 0 :(得分:1)

public await Task<JsonResult> Save(User eUser, Request eRequest)
{
    await Execute();

    try
    {
        //Look at it later
        eUser.Password = EncryptHelper.EncryptString(eUser.Password, "kahat");
        eUser.Password1 = EncryptHelper.EncryptString(eUser.Password1, "kahat123");
        this.rpGeneric.SaveOrUpdate<User>(eUser);
        this.rpGeneric.SaveOrUpdate<Request>(eRequest);
        return GetAll();
    }
    catch (Exception ex)
    {
        return ThrowJsonError(ex);
    }
}

在大多数情况下,请勿对任务调用.Wait()。相反,请将您的方法标记为异步并将await标记为调用结果。

相关问题