【问题标题】:Examples of asp.net mvc and authenticationasp.net mvc 和认证示例
【发布时间】:2008-10-18 21:46:56
【问题描述】:

我正在寻找一些 asp.net mvc 示例,这些示例使用基于集成 asp.net 表单身份验证的成员资格提供程序以及编辑和发布方案。我正在这里寻找最佳做法。

假设我的数据库中有一个 Contacts 表,其中包含一个 Name 字段和一个与 aspnet_Users UserId 字段相关联的 UserId 字段。我想到了这样的事情:

public ActionResult Save([Bind(Include="Name")] Contact contact)
{
       // if null etc. checks omitted for this example
       MembershipUser currentUser = Provider.GetUser(User.Identity.Name, true);
       contact.UserId = (Guid)currentUser.ProviderUserKey;
       //save etc.
}

对此有任何提示或指南吗?

【问题讨论】:

    标签: asp.net-mvc asp.net-membership forms-authentication


    【解决方案1】:

    我还没有详细介绍它……但是,this 可以帮忙吗?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-03-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-06-09
      • 2011-04-26
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多