更改CreateUserWizard控件的字段映射与成员资格提供asp.net 4.0 [英] Change Mapping of fields of CreateUserWizard control with membership provider asp.net 4.0

查看:81
本文介绍了更改CreateUserWizard控件的字段映射与成员资格提供asp.net 4.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用CreateUserWizard控件在asp.net membersip提供4.0

I am using CreateUserWizard Control with membersip provider in asp.net 4.0

在这种情况下,用户名是用户名字段店aspnet_Users表格内

In this case user name is store in 'user name' field in aspnet_Users table

我要保存aspnet_Membership表的电子邮件领域的用户名字段(在我的情况下,用户名也电子邮件)
换句话说,我要改变这些领域的映射。

I want to save 'user name' field in email field of aspnet_Membership table(In my case username is also email) In other words I want to change mapping of these fields.

我怎样才能做到这一点。

How can I do this

注意:我的问题是如何改变mapping.Above唯才是举

由于提前

推荐答案

您可以通过调用CREATEUSER方法,而不是使用的CreateUserWizard容易achive。

You can easily achive by calling CreateUser method instead of using CreateUserWizard.

<asp:TextBox ID="EmailTextBox" runat="Server" />
<asp:TextBox ID="PasswordTextBox" runat="Server" />
<asp:TextBox ID="PasswordQuestionTextBox" runat="Server" />
<asp:TextBox ID="PasswordAnswerTextBox" runat="Server" />

string username = EmailTextBox.text; // Same as email
string password = PasswordTextBox.text;
string email = EmailTextBox.text;
string passwordQuestion = PasswordQuestionTextBox.text;
string passwordAnswer = PasswordAnswerTextBox.text;
bool isApproved = true;

MembershipCreateStatus status;

MembershipUser membershipUser = System.Web.Security.Membership.CreateUser(username, password, email, passwordQuestion, passwordAnswer, isApproved, out status);

if (status != MembershipCreateStatus.Success)
   throw new Exception(status.ToString());

这篇关于更改CreateUserWizard控件的字段映射与成员资格提供asp.net 4.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆