4

我正在寻找一些 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.
}

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

4

1 回答 1

3

我还没有详细介绍它……但是,有帮助吗?

于 2008-10-18T22:06:41.903 回答