Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
会员及;在asp.net中使用createuserwizard和登录控件需要配置文件帮助_Asp.net_Asp.net Membership_Login Control_Createuserwizard - Fatal编程技术网

会员及;在asp.net中使用createuserwizard和登录控件需要配置文件帮助

会员及;在asp.net中使用createuserwizard和登录控件需要配置文件帮助,asp.net,asp.net-membership,login-control,createuserwizard,Asp.net,Asp.net Membership,Login Control,Createuserwizard,我正在从事一个项目,在该项目中,我获得了创建用户的任务(使用CreateUserWizard控件)。我必须将用户保存在SQL Server数据库中的特定表中 还要创建一个登录名(使用登录控件),登录名经过身份验证后,它应该保存配置文件信息 到目前为止,我已经创建了继承ProfileBase的CustomProfile。还创建了3个aspx页面 Login.aspx CreateUser.aspx Default.aspx 我的CustomProfile如下所示: public class Use

我正在从事一个项目,在该项目中,我获得了创建用户的任务(使用CreateUserWizard控件)。我必须将用户保存在SQL Server数据库中的特定表中

还要创建一个登录名(使用登录控件),登录名经过身份验证后,它应该保存配置文件信息

到目前为止,我已经创建了继承ProfileBase的CustomProfile。还创建了3个aspx页面

  • Login.aspx
  • CreateUser.aspx
  • Default.aspx
  • 我的CustomProfile如下所示:

    public class UserProfile : ProfileBase
    {
        static public UserProfile CurrentUser
        {
            get
            {
                return (UserProfile)(ProfileBase.Create(Membership.GetUser().UserName));
            }
        }
    
        public string FirstName
        {
            get { return (string)base["FirstName"]; }
            set { base["FirstName"] = value; Save(); }
        }
    
    
        public string LastName
        {
            get { return (string)base["LastName"]; }
            set { base["LastName"] = value; Save(); }
        }
    
        public DateTime DateOfBirth
        {
            get { return (DateTime)base["DateOfBirth"]; }
            set { base["DateOfBirth"] = value; Save(); }
        }
    
        public ContactInfo Contact
        {
            get { return (ContactInfo)base["Contact"]; }
            set { base["Contact"] = value; Save(); }
        }
    }
    
    我使用了
    aspnet_regsql.exe
    ,它在sql server中创建了多个表,并将数据存储在这些表中,工作正常。我想将信息保存到我的表中,例如
    tblUserInfo
    。我应该如何进行?我查看了多个论坛,但运气不好


    非常感谢您的帮助。

    首先,aspnet_regsql.exe已经过时。您可能想考虑使用.</P> 我假设您的问题是将信息保存到我的表格中,例如tblUserInfo

    您可以自行收集并保存用户信息,而不是使用CreateUserWizard


    太好了。如果你真的问了一个问题,你可能会得到更多的结果。@MystereMan:我对asp.net很陌生,不确定在这种情况下什么是好问题。抱歉搞混了,谢谢你,伙计。看起来是我一直在寻找的解决方案。
    <asp:TextBox ID="UsernameTextBox" runat="Server" /> 
    <asp:TextBox ID="EmailTextBox" runat="Server" /> 
    <asp:TextBox ID="PasswordTextBox" runat="Server" /> 
    <asp:TextBox ID="PasswordQuestionTextBox" runat="Server" /> 
    <asp:TextBox ID="PasswordAnswerTextBox" runat="Server" /> 
    <asp:TextBox ID="FirstNameTextBox" runat="Server" /> 
    <asp:TextBox ID="LastNameTextBox" runat="Server" /> 
    
    string username = UsernameTextBox;  
    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()); 
    
    // Save the rest of the user info to tblUserInfo with userId
    Guid userId = (Guid)membershipUser.ProviderUserKey;