locked
Help - Why New Account is not being created RRS feed

  • Question

  • User1402743388 posted

    Hi,

    It seems like I have everything set up right but when I try to create new account the form is cleared and nothing happens and CreateUserWizard Just end up cleared.

    I tried adding section to my code to debug and here is what it looks like My code behind but none of he events are hit. My breakpoints are not activated for any of the methods below.:

    using System;
    using System.Data;
    using System.Configuration;
    using System.Collections;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    
    public partial class Register : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string xx = "";
        }
        protected void CreateUserWizard1_CreatingUser(object sender, LoginCancelEventArgs e)
        {
            string xx = "";
        }
        protected void CreateUserWizard1_CreateUserError(object sender, CreateUserErrorEventArgs e)
        {
            string xx = "";
        }
        protected void CreateUserWizard1_DataBinding(object sender, EventArgs e)
        {
            string xx = "";
        }
        protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e)
        {
             Roles.AddUserToRole(((CreateUserWizard)sender).UserName, "Group_User");
        }
    }
    

    My control page has the following:

      <asp:CreateUserWizard ID="CreateUserWizard1" runat="server" 
                    OnCreatingUser="CreateUserWizard1_CreatingUser" 
                    OnCreateUserError="CreateUserWizard1_CreateUserError" 
                    OnDataBinding="CreateUserWizard1_DataBinding" OnCreatedUser="CreateUserWizard1_CreatedUser">
                    <WizardSteps>
                        <asp:CreateUserWizardStep runat="server" />
                        <asp:CompleteWizardStep runat="server" />
                    </WizardSteps>
                    <SideBarStyle BackColor="#5D7B9D" BorderWidth="0px" Font-Size="0.9em" VerticalAlign="Top" />
                    <MailDefinition From="NoReply@Qatune.com" Subject="Account is created">
                    </MailDefinition>
                    <TitleTextStyle BackColor="#00B0F0" Font-Bold="True" ForeColor="White" />
                    <SideBarButtonStyle BorderWidth="0px" Font-Names="Verdana" ForeColor="White" />
                    <NavigationButtonStyle  CssClass="art-button" />
                    <HeaderStyle BackColor="#5D7B9D" BorderStyle="Solid" Font-Bold="True" Font-Size="0.9em"
                        ForeColor="White" HorizontalAlign="Center" />
                    <CreateUserButtonStyle CssClass="art-button" />
                    <ContinueButtonStyle  CssClass="art-button" />
                    <StepStyle BorderWidth="0px" />
                </asp:CreateUserWizard>

    Here is the configutation:

    Web.config

    <?xml version="1.0"?>
    <configuration>
      <system.net>
        <mailSettings>
          <smtp from="noreply@xxxxx.com">
            <network host="Mail.xxxxxx.com" port="25" userName="NoReply@xxxxx.com" password="xxxxx"/>
          </smtp>
        </mailSettings>
      </system.net>
      <connectionStrings>
        <add name="SqlConnection" connectionString="Data Source=Localhost;Initial Catalog=xxxxx;User Id=sa;Password=xxxxxxxx"  providerName="System.Data.SqlClient"/>
      </connectionStrings>
    	<appSettings/>
    	<system.web>
        <globalization
                fileEncoding="utf-8"
                requestEncoding="utf-8"
                responseEncoding="utf-8"
        />
    		<compilation debug="true">
          <assemblies>
            <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
          </assemblies>
        </compilation>
    
        <authentication mode="Forms" >
          <forms loginUrl="login.aspx"
            name=".ASPXFORMSAUTH" />
        </authentication>
        <authorization>
          <allow users="*" />
        </authorization>
        <membership defaultProvider="SqlProvider" userIsOnlineTimeWindow="15">
          <providers>
            <clear />
            <add
              name="SqlProvider"
              type="System.Web.Security.SqlMembershipProvider"
              connectionStringName="SqlConnection"
              applicationName="/"
             enablePasswordRetrieval="true" 
              enablePasswordReset="true" 
              requiresQuestionAndAnswer="true" 
              requiresUniqueEmail="true" 
              passwordFormat="Clear" 
              maxInvalidPasswordAttempts="5" 
              minRequiredPasswordLength="5" 
              minRequiredNonalphanumericCharacters="0" 
              passwordAttemptWindow="10" 
              passwordStrengthRegularExpression="" />
          </providers>
        </membership>
        <profile>
          <providers>
            <clear/>
            <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="SqlConnection" applicationName="/"/>
          </providers>
          <properties>
            <add name="Country" type="string"/>
            <add name="Gender" type="string"/>
            <add name="Age" type="Int32"/>
          </properties>
        </profile>
        <roleManager enabled="true">
          <providers>
            <clear/>
            <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="SqlConnection" applicationName="/"/>
          </providers>
        </roleManager>
        <customErrors mode="Off"/>
        <pages theme="Theme1" />
        <sessionState mode="InProc" timeout="20"/>
        <machineKey validationKey="F9D1A2D3E1D3E2F7B3D9F90FF3965ABDAC304902" decryptionKey="F9D1A2D3E1D3E2F7B3D9F90FF3965ABDAC304902F8D923AC" validation="SHA1"/>
      </system.web>
    </configuration>
    

    Any assistance is greatly appreciated.

    Tuesday, May 13, 2014 9:41 PM

Answers

  • User1140095199 posted

    Hi,

    It seems like I have everything set up right but when I try to create new account the form is cleared and nothing happens and CreateUserWizard Just end up cleared.

    I tried adding section to my code to debug and here is what it looks like My code behind but none of he events are hit. My breakpoints are not activated for any of the methods below.:

      <connectionStrings>
        <add name="SqlConnection" connectionString="Data Source=Localhost;Initial Catalog=xxxxx;User Id=sa;Password=xxxxxxxx"  providerName="System.Data.SqlClient"/>
      </connectionStrings>

    As I can see that you are using ConnectionString that points to your SQL Server. Firstly make sure that the ConnectionString is correct. Secondly check if the DataBase for the Membership and Roles being generated in the DataBase or NOT. The Tables that store the info are auto-generated. If they are NOT being generated use the Aspnet_regsql.exe Tool to generate the database in SQL Server then use proper connectionstring.

    ASP.NET SQL Server Registration Tool (Aspnet_regsql.exe) :

    The ASP.NET SQL Server Registration tool is used to create a Microsoft SQL Server database for use by the SQL Server providers in ASP.NET, or to add or remove options from an existing database. The Aspnet_regsql.exe file is located in the [drive:]\%windir%\Microsoft.NET\Framework\version folder on your Web server.

    You can run Aspnet_regsql.exe without any command-line arguments to run a wizard that will walk you through specifying connection information for your SQL Server installation, and installing or removing the database elements for the membership, role management, profile, Web Parts personalization, and health monitoring features. (Setting session state and SQL cache dependency are not covered by the wizard.)

    Source Article - http://msdn.microsoft.com/en-US/library/ms229862(v=vs.80).aspx

    You may also use the Membership class to create the User. For more reference:

    http://forums.asp.net/t/1917442.aspx?Membership+Create+User+Wizard+not+going+to+Complete+page

    http://msdn.microsoft.com/en-us/library/82xx2e62(v=vs.110).aspx

    Hope it helps!

    Best Regards!

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, May 14, 2014 11:38 PM