We help IT Professionals succeed at work.

CreateUser Wizard. when I remove the security question or answer, I get ...

mathieu_cupryk
on
1,916 Views
Last Modified: 2012-08-13
I want to remove bothe from the code.
<legend>Security Question:</legend><span>                        <asp:TextBox runat="server" ID="Question" CssClass="register_question"></asp:TextBox></span>
                                                      <asp:RequiredFieldValidator runat="server" ControlToValidate="Question" ValidationGroup="CreateUserWizardControl" ErrorMessage="Security question is required." ToolTip="Security question is required." ID="QuestionRequired"></asp:RequiredFieldValidator>
                                                      <legend>Security Answer:</legend><span>
                                                      <asp:TextBox runat="server" ID="Answer" CssClass="register_question"></asp:TextBox></span>
                                                      <asp:RequiredFieldValidator runat="server" ControlToValidate="Answer" ValidationGroup="CreateUserWizardControl" ErrorMessage="Security answer is required." ToolTip="Security answer is required." ID="AnswerRequired">
                                                      </asp:RequiredFieldValidator>

I get the folloing error:

Using themed css files requires a header control on the page. (e.g. <head runat="server" />). 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
 
Exception Details: System.InvalidOperationException: Using themed css files requires a header control on the page. (e.g. <head runat="server" />).
 
Source Error: 
 
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  
 
Stack Trace: 
 
 
[InvalidOperationException: Using themed css files requires a header control on the page. (e.g. <head runat="server" />).]
   System.Web.UI.PageTheme.SetStyleSheet() +1998478
   System.Web.UI.Page.OnInit(EventArgs e) +2062526
   System.Web.UI.Control.InitRecursive(Control namingContainer) +321
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +834

Open in new window

Comment
Watch Question

Can you post your source code?

Author

Commented:
Sure,

<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" CodeFile="Register.aspx.cs"
      Inherits="Register_aspx" Title="Register" %>
<%@ Register src="~/Controls/Countries.ascx" tagname="Countries" tagprefix="CustomControl" %>
<%@ Register src="~/Controls/Gender.ascx" tagname="Gender" tagprefix="CustomControl" %>
<%@ Register src="~/Controls/Ethnicity.ascx" tagname="Ethnicity" tagprefix="CustomControl" %>

<asp:Content ID="MainContent" ContentPlaceHolderID="Main" runat="server">
      <div id="body">
            <div id="col_main_left">
                  <div id="user_assistance">
                        <a id="content_start"></a>
                        All you have to do is fill in the information on the right.
                              <br><br>
                              After the information is received we will send you a confirmation e-mail on the
                              e-mail address you specify. You must click on the link in that e-mail to
                              activate your account. After you activate your account you'll be redirected to
                              a page where you can create your profile and upload photos.
                  </div>
            </div>
            <div id="col_main_right">
                  <h2 class="section">
                        Register</h2>
                  <div class="content_right">
                        <asp:Label ID="InfoLabel" runat="server" ForeColor="Red" Font-Italic="true" Visible="false" />
       <fieldset>
                              <asp:CreateUserWizard ID="CreateUserWizardControl" runat="server" OnCreatedUser="CreateUserWizardControl_CreatedUser"
                                    CreateUserButtonText="Submit" TitleTextStyle-Height="50px" FinishDestinationPageUrl="~/Default.aspx"
                                    ContinueDestinationPageUrl="~/Default.aspx" ContinueButtonText="Continue to Homepage"
                                    ContinueButtonType="Link" ActiveStepIndex="0" CssClass="register_text" OnCreateUserError="CreateUserWizardControl_CreateUserError">
                                    <WizardSteps>
                                          <asp:CreateUserWizardStep ID="CreateUserWizardStep1" runat="server" Title="Account Details:">
                                                <ContentTemplate>
                                                      <legend>User Name:</legend><span>
                                                            <asp:TextBox runat="server" ID="UserName" CssClass="user_info"></asp:TextBox></span>
                                                      <asp:RequiredFieldValidator runat="server" ControlToValidate="UserName" ValidationGroup="CreateUserWizardControl"
                                                            ErrorMessage="User name is required." ToolTip="User name is required." ID="UserNameRequired"
                                                            Display="Dynamic">
                                                      </asp:RequiredFieldValidator>
                                                      <asp:RegularExpressionValidator runat="server" ControlToValidate="UserName" ValidationGroup="CreateUserWizardControl"
                                                            ValidationExpression="^[0-9a-zA-Z''-'\s]{1,40}$" ErrorMessage="User name is required and must be less than 40 characters long and contain only alphanumerics, apostrophes, spaces, or periods."
                                                            ToolTip="A valid user name is required." ID="UserNameRequiredFormat" Display="Dynamic">
                                                      </asp:RegularExpressionValidator>
                                                      <legend>Password:</legend><span>
                                                            <asp:TextBox runat="server" TextMode="Password" ID="Password" CssClass="register_password"></asp:TextBox></span>
                                                      <asp:RequiredFieldValidator runat="server" ControlToValidate="Password" ValidationGroup="CreateUserWizardControl"
                                                            ErrorMessage="Password is required." ToolTip="Password is required." ID="PasswordRequired">
                                                      </asp:RequiredFieldValidator>
                                                      <legend>Confirm Password:</legend><span>
                                                            <asp:TextBox runat="server" TextMode="Password" ID="ConfirmPassword" CssClass="register_password"></asp:TextBox></span>
                                                      <asp:RequiredFieldValidator runat="server" ControlToValidate="ConfirmPassword" ValidationGroup="CreateUserWizardControl"
                                                            ErrorMessage="Confirm password is required." ToolTip="Confirm password is required."
                                                            ID="ConfirmPasswordRequired">
                                                      </asp:RequiredFieldValidator>
                                                      <legend>Email:</legend><span>
                                                            <asp:TextBox runat="server" ID="Email" CssClass="user_info"></asp:TextBox></span>
                                                      <asp:RequiredFieldValidator runat="server" ControlToValidate="Email" ValidationGroup="CreateUserWizardControl"
                                                            ErrorMessage="Email is required." ToolTip="Email is required." ID="EmailRequired"
                                                            Display="Dynamic">
                                                      </asp:RequiredFieldValidator>
                                                      <asp:RegularExpressionValidator runat="server" ControlToValidate="Email" ValidationGroup="CreateUserWizardControl"
                                                            ValidationExpression="^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$"
                                                            ErrorMessage="A valid email is required." ToolTip="A valid email is required."
                                                            ID="EmailRequiredFormat" Display="dynamic">
                                                      </asp:RegularExpressionValidator>
                                                      
                                                      <legend>Gender:</legend><span>
                                                      <CustomControl:Gender ID="MyGender" runat="server" /></span>
                                                      
                                                      <legend>Ethnicity:</legend><span>
                                                      <CustomControl:Ethnicity ID="MyEthnicity" runat="server" /></span>
                                                      
                                                      <legend>Country:</legend><span>
                                                      <CustomControl:Countries ID="MyCountries" runat="server" /></span>

                                                      

                                                      
                                                      
                                                      
                                                      
                                                      <legend>Security Question:</legend><span>
                                                            <asp:TextBox runat="server" ID="Question" CssClass="register_question"></asp:TextBox></span>
                                                      <asp:RequiredFieldValidator runat="server" ControlToValidate="Question" ValidationGroup="CreateUserWizardControl"
                                                            ErrorMessage="Security question is required." ToolTip="Security question is required."
                                                            ID="QuestionRequired">
                                                      </asp:RequiredFieldValidator>
                                                      <legend>Security Answer:</legend><span>
                                                            <asp:TextBox runat="server" ID="Answer" CssClass="register_question"></asp:TextBox></span>
                                                      <asp:RequiredFieldValidator runat="server" ControlToValidate="Answer" ValidationGroup="CreateUserWizardControl"
                                                            ErrorMessage="Security answer is required." ToolTip="Security answer is required."
                                                            ID="AnswerRequired">
                                                      </asp:RequiredFieldValidator>
                                                      <asp:CompareValidator runat="server" ControlToValidate="ConfirmPassword" ValidationGroup="CreateUserWizardControl"
                                                            ID="PasswordCompare" Display="Dynamic" ErrorMessage="The password and confirmation password must match."
                                                            ControlToCompare="Password">
                                                      </asp:CompareValidator>
                                                      <asp:Literal runat="server" ID="FailureText" EnableViewState="True"></asp:Literal>
                                                </ContentTemplate>
                                          </asp:CreateUserWizardStep>
                                          <asp:CompleteWizardStep ID="CompleteWizardStep1" runat="server">
                                          </asp:CompleteWizardStep>
                                    </WizardSteps>
                                    <FinishNavigationTemplate>
                                          <asp:Button runat="server" CausesValidation="False" Text="Previous" CommandName="MovePrev"
                                                ID="FinishPreviousButton" />
                                          <asp:Button runat="server" Text="Finish" CommandName="MoveToFinish" ID="FinishButton" />
                                    </FinishNavigationTemplate>
                                    <TitleTextStyle Height="50px"></TitleTextStyle>
                              </asp:CreateUserWizard>
                        </fieldset>
                        </div>
            </div>
      </div>            
 
</asp:Content>
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
In the web.config.

<system.web>
            <trace enabled="true" pageOutput="true" />
  <customErrors defaultRedirect="Error.aspx" mode="RemoteOnly"/>
            <pages styleSheetTheme="Red"/>
            <authentication mode="Forms"/>

So it points to Appthemes folder Red?

I still have the problem when u tell me to change it.

Author

Commented:
it is specified in the web.config. the css.

I need to remove secret answer and secret question from creatwizard below without getting a css error.



<asp:CreateUserWizard ID="CreateUserWizardControl" runat="server" OnCreatedUser="CreateUserWizardControl_CreatedUser"

CreateUserButtonText="Submit" TitleTextStyle-Height="50px" FinishDestinationPageUrl="~/Default.aspx"

ContinueDestinationPageUrl="~/Default.aspx" ContinueButtonText="Continue to Homepage"

ContinueButtonType="Link" ActiveStepIndex="0" CssClass="register_text" OnCreateUserError="CreateUserWizardControl_CreateUserError">

<WizardSteps>

<asp:CreateUserWizardStep ID="CreateUserWizardStep1" runat="server" Title="Account Details:">

<ContentTemplate>

<legend>User Name:</legend><span>

<asp:TextBox runat="server" ID="UserName" CssClass="user_info"></asp:TextBox></span>

<asp:RequiredFieldValidator runat="server" ControlToValidate="UserName" ValidationGroup="CreateUserWizardControl"

ErrorMessage="User name is required." ToolTip="User name is required." ID="UserNameRequired"

Display="Dynamic">

</asp:RequiredFieldValidator>

<asp:RegularExpressionValidator runat="server" ControlToValidate="UserName" ValidationGroup="CreateUserWizardControl"

ValidationExpression="^[0-9a-zA-Z''-'\s]{1,40}$" ErrorMessage="User name is required and must be less than 40 characters long and contain only alphanumerics, apostrophes, spaces, or periods."

ToolTip="A valid user name is required." ID="UserNameRequiredFormat" Display="Dynamic">

</asp:RegularExpressionValidator><legend>Password:</legend><span>

<asp:TextBox runat="server" TextMode="Password" ID="Password" CssClass="register_password"></asp:TextBox></span>

<asp:RequiredFieldValidator runat="server" ControlToValidate="Password" ValidationGroup="CreateUserWizardControl"

ErrorMessage="Password is required." ToolTip="Password is required." ID="PasswordRequired">

</asp:RequiredFieldValidator>

<legend>Confirm Password:</legend><span>

<asp:TextBox runat="server" TextMode="Password" ID="ConfirmPassword" CssClass="register_password"></asp:TextBox></span>

<asp:RequiredFieldValidator runat="server" ControlToValidate="ConfirmPassword" ValidationGroup="CreateUserWizardControl"

ErrorMessage="Confirm password is required." ToolTip="Confirm password is required."

ID="ConfirmPasswordRequired">

</asp:RequiredFieldValidator>



<legend>Email:</legend><span>

<asp:TextBox runat="server" ID="Email" CssClass="user_info"></asp:TextBox></span>

<asp:RequiredFieldValidator runat="server" ControlToValidate="Email" ValidationGroup="CreateUserWizardControl" ErrorMessage="Email is required." ToolTip="Email is required." ID="EmailRequired" Display="Dynamic"></asp:RequiredFieldValidator>


<asp:RegularExpressionValidator runat="server" ControlToValidate="Email" ValidationGroup="CreateUserWizardControl" ValidationExpression="^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$" ErrorMessage="A valid email is required." ToolTip="A valid email is required." ID="EmailRequiredFormat" Display="dynamic">

</asp:RegularExpressionValidator>


<legend>Gender:</legend><span>

<CustomControl:Gender ID="MyGender" runat="server" /></span>


<legend>Ethnicity:</legend><span>

<CustomControl:Ethnicity ID="MyEthnicity" runat="server" /></span>


<legend>Date of Birth:</legend><span>

<CustomControl:BirthDate ID="MyBirthDate" runat="server" /></span>


<legend>Country:</legend><span>

<CustomControl:Countries ID="MyCountries" runat="server" /></span>


<legend>Security Question:</legend><span>

<asp:TextBox runat="server" ID="Question" CssClass="register_question"></asp:TextBox></span>

<asp:RequiredFieldValidator runat="server" ControlToValidate="Question" ValidationGroup="CreateUserWizardControl"

ErrorMessage="Security question is required." ToolTip="Security question is required."

ID="QuestionRequired">

</asp:RequiredFieldValidator>


<legend>Security Answer:</legend><span>

<asp:TextBox runat="server" ID="Answer" CssClass="register_question"></asp:TextBox></span>

<asp:RequiredFieldValidator runat="server" ControlToValidate="Answer" ValidationGroup="CreateUserWizardControl"

ErrorMessage="Security answer is required." ToolTip="Security answer is required."

ID="AnswerRequired">

</asp:RequiredFieldValidator>

<asp:CompareValidator runat="server" ControlToValidate="ConfirmPassword" ValidationGroup="CreateUserWizardControl"

ID="PasswordCompare" Display="Dynamic" ErrorMessage="The password and confirmation password must match."

ControlToCompare="Password">

</asp:CompareValidator>

<asp:Literal runat="server" ID="FailureText" EnableViewState="True"></asp:Literal>

</ContentTemplate>

</asp:CreateUserWizardStep>

<asp:CompleteWizardStep ID="CompleteWizardStep1" runat="server">

</asp:CompleteWizardStep>

</WizardSteps>

<FinishNavigationTemplate>

<asp:Button runat="server" CausesValidation="False" Text="Previous" CommandName="MovePrev"

ID="FinishPreviousButton" />

<asp:Button runat="server" Text="Finish" CommandName="MoveToFinish" ID="FinishButton" />

</FinishNavigationTemplate>
If you don't remove it, it doesn't throw an error?

Check out this link: http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=102039

Author

Commented:
It is in the master page? <head id="HeadElement" runat="server">
There is suppose to be a way in the web.config file to disable this.

Author

Commented:
U know something Dig,
U are amazing...

I did it.

Is this a bug?

Author

Commented:
Excellent job
Hey glad it worked! And thanks. ;)
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.