如何防止在asp.net中重定向注册用户

时间:2014-03-18 17:12:40

标签: asp.net createuserwizard

嗨我正在使用createuserwizard服务器控件,但是当我通过此控件注册用户时它面临一点点问题它会自动导航并登录到创建的用户我不希望在用户创建时自动转到它如何能够可能有任何想法。

这是aspx代码: -

<asp:CreateUserWizard ID="CreateUserWizard1" runat="server" OnCreatedUser="CreateUserWizard1_CreatedUser" OnNextButtonClick="CreateUserWizard1_NextButtonClick">
                <WizardSteps>

                    <asp:WizardStep ID="CreateUserWizardStep0" runat="server">
                        <table cellpadding="1" cellspacing="0" style="border-collapse: collapse;" class="MarginStyle">
                            <tr>
                                <td>
                                    <h4 class="HeadingThemeColor align I18N">TitleAddTeacher</h4>
                                </td>

                            </tr>
                            <tr>
                                <td>
                                    <table cellpadding="10">
                                        <tr>
                                            <td>
                                                <asp:Label ID="LblOrganization" CssClass="lblStyle I18N" runat="server">form.data.Organizations</asp:Label>
                                                <br />
                                                <br />
                                                <asp:DropDownList ID="DplOrganization" runat="server">

                                                </asp:DropDownList>
                                                <br />
                                                <asp:RequiredFieldValidator ID="DplOrganizationRequiredFieldValidator" runat="server"
                                                    ControlToValidate="DplOrganization" Display="Dynamic" ErrorMessage="Organization Name must Selected."
                                                    ToolTip="Organization Name must Selected." ValidationGroup="AddInstitution"><span class="err I18N">error.messages.Organization Name must Selected</span></asp:RequiredFieldValidator>
                                            </td>

                                            <td>
                                                <asp:Label ID="LblInstitutes" CssClass="lblStyle I18N" runat="server">form.data.Institutes</asp:Label>
                                                <br />
                                                <br />
                                                <asp:DropDownList ID="DplInstitutes" runat="server">

                                                </asp:DropDownList>
                                                <br />
                                                <asp:RequiredFieldValidator ID="DplInstitutesRequiredFieldValidator" runat="server"
                                                    ControlToValidate="DplInstitutes" Display="Dynamic" ErrorMessage="Institute Name must Selected."
                                                    ToolTip="Institute Name must Selected." ValidationGroup="AddBranch"><span class="err I18N">error.messages.Institute Name must Selected</span></asp:RequiredFieldValidator>
                                            </td>



                                        </tr>

                                        <tr>

                                            <td>
                                                <asp:Label ID="LblBranches" CssClass="lblStyle I18N" runat="server">form.data.Branches</asp:Label>
                                                <br />
                                                <br />
                                                <asp:DropDownList ID="DplBranch" runat="server">

                                                </asp:DropDownList>
                                                <br />
                                                <asp:RequiredFieldValidator ID="DplBranchRequiredFieldValidator" runat="server"
                                                    ControlToValidate="DplBranch" Display="Dynamic" ErrorMessage="Branch Name must Selected."
                                                    ToolTip="Branch Name must Selected." ValidationGroup="AddInstitution"><span class="err I18N">error.messages.Branch Name must Selected</span></asp:RequiredFieldValidator>
                                            </td>

                                            <td>
                                                <asp:Label ID="Label4" CssClass="lblStyle I18N" runat="server">form.data.Marital Status</asp:Label>
                                                <br />
                                                <br />
                                                <asp:TextBox ID="TxtMaritalStatus" runat="server" CssClass="txt" placeholder="Marital Status" TextMode="SingleLine"></asp:TextBox>
                                                <br />
                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator16" runat="server"
                                                    ControlToValidate="TxtMaritalStatus" Display="Dynamic" ErrorMessage="Marital Status is required."
                                                    ToolTip="Marital Status is required." ValidationGroup="AddTeacher"><span class="err I18N">error.messages.Marital Status is required</span></asp:RequiredFieldValidator>
                                            </td>
                                        </tr>

                                        <tr>
                                            <td>
                                                <asp:Label ID="Label5" CssClass="lblStyle I18N" runat="server">form.data.Company</asp:Label>
                                                <br />
                                                <br />
                                                <asp:TextBox ID="TxtCompany" runat="server" CssClass="txt" placeholder="Company" TextMode="SingleLine"></asp:TextBox>
                                                <br />
                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator17" runat="server"
                                                    ControlToValidate="TxtCompany" ErrorMessage="Company is required."
                                                    ToolTip="Company is required." Display="Dynamic" ValidationGroup="AddTeacher"><span class="err I18N">error.messages.Company is required</span></asp:RequiredFieldValidator>
                                            </td>
                                            <td>
                                                <asp:Label ID="Label6" CssClass="lblStyle I18N" runat="server">form.data.Occupation</asp:Label>
                                                <br />
                                                <br />
                                                <asp:TextBox ID="TxtOccupation" runat="server" CssClass="txt" placeholder="Teacher Occupation" TextMode="SingleLine"></asp:TextBox>
                                                <br />
                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator19" runat="server"
                                                    ControlToValidate="TxtOccupation" ErrorMessage="Teacher Occupation is required."
                                                    ToolTip="Teacher Occupation is required." Display="Dynamic" ValidationGroup="AddTeacher"><span class="err I18N">error.messages.Occupation is required</span></asp:RequiredFieldValidator>
                                            </td>
                                        </tr>

                                        <tr>
                                            <td>
                                                <asp:Label ID="Label7" CssClass="lblStyle I18N" runat="server">form.data.Passport Numer</asp:Label>
                                                <br />
                                                <br />
                                                <asp:TextBox ID="TxtPassportNumer" runat="server" CssClass="txt" placeholder="Teacher Postal Code" TextMode="SingleLine"></asp:TextBox>
                                                <br />
                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator20" runat="server"
                                                    ControlToValidate="TxtPassportNumer" ErrorMessage="Teacher Passport Numer is required."
                                                    ToolTip="Teacher Passport Numer is required." Display="Dynamic" ValidationGroup="AddTeacher"><span class="err I18N">error.messages.Passport Numer is required</span></asp:RequiredFieldValidator>

                                            </td>
                                            <td>
                                                <asp:Label ID="Label8" CssClass="lblStyle I18N" runat="server">form.data.Upload Image</asp:Label>
                                                <br />
                                                <br />
                                                <asp:FileUpload ID="FileUpload1" runat="server" />

                                            </td>
                                        </tr>

                                    </table>
                                </td>
                            </tr>
                        </table>
                    </asp:WizardStep>

                    <asp:CreateUserWizardStep ID="CreateUserWizardStep1" runat="server">
                        <ContentTemplate>
                            <table cellpadding="1" cellspacing="0" style="border-collapse: collapse;" class="MarginStyle">
                                <tr>
                                    <td>
                                        <h4 class="HeadingThemeColor align I18N">TitleAddTeacher</h4>
                                    </td>

                                </tr>
                                <tr>
                                    <td>
                                        <table cellpadding="10">
                                            <tr>
                                                <td>
                                                    <asp:Label ID="LblUserName" CssClass="lblStyle I18N" runat="server">form.data.UserName</asp:Label>
                                                    <br />
                                                    <br />
                                                    <asp:TextBox runat="server" ID="UserName" CssClass="txt" placeholder="User Name" TextMode="SingleLine"></asp:TextBox>
                                                    <br />
                                                    <asp:RequiredFieldValidator ID="UserNameRequired" runat="server"
                                                        ControlToValidate="UserName" Display="Dynamic" ErrorMessage="User Name is required."
                                                        ToolTip="User Name is required." ValidationGroup="AddTeacher"><span class="err I18N">error.messages.User Name is required</span></asp:RequiredFieldValidator>
                                                </td>

                                                <td>
                                                    <asp:Label ID="LblPassword" CssClass="lblStyle I18N" runat="server">form.data.Password</asp:Label>
                                                    <br />
                                                    <br />
                                                    <asp:TextBox runat="server" ID="Password" TextMode="Password" CssClass="txt" placeholder="Password"></asp:TextBox>
                                                    <br />
                                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator9" runat="server"
                                                        ControlToValidate="Password" Display="Dynamic" ErrorMessage="Password is required."
                                                        ToolTip="Password is required." ValidationGroup="AddTeacher"><span class="err I18N">error.messages.Password is required</span></asp:RequiredFieldValidator>
                                                </td>

                                            </tr>

                                            <tr>
                                                <td>
                                                    <asp:Label ID="LblConfirmPassword" CssClass="lblStyle I18N" runat="server">form.data.Confirm Password</asp:Label>
                                                    <br />
                                                    <br />
                                                    <asp:TextBox runat="server" ID="ConfirmPassword" CssClass="txt" placeholder="Confirm Password" TextMode="Password"></asp:TextBox>
                                                    <br />
                                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator10" runat="server"
                                                        ControlToValidate="ConfirmPassword" Display="Dynamic" ErrorMessage="Confirm Password is required."
                                                        ToolTip="User Name is required." ValidationGroup="AddTeacher"><span class="err I18N">error.messages.Confirm Password is required</span></asp:RequiredFieldValidator>
                                                </td>

                                                <td>
                                                    <asp:Label ID="LblEmail" CssClass="lblStyle I18N" runat="server">form.data.Email</asp:Label>
                                                    <br />
                                                    <br />
                                                    <asp:TextBox runat="server" ID="Email" TextMode="SingleLine" CssClass="txt" placeholder="Email"></asp:TextBox>
                                                    <br />
                                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator18" runat="server"
                                                        ControlToValidate="Email" Display="Dynamic" ErrorMessage="Email is required."
                                                        ToolTip="Email is required." ValidationGroup="AddTeacher"><span class="err I18N">error.messages.Email is required</span></asp:RequiredFieldValidator>
                                                </td>

                                            </tr>

                                            <tr>
                                                <td>
                                                    <asp:Label ID="LblQuestion" CssClass="lblStyle I18N" runat="server">form.data.Question</asp:Label>
                                                    <br />
                                                    <br />
                                                    <asp:TextBox runat="server" ID="Question" CssClass="txt" placeholder="Question" TextMode="SingleLine"></asp:TextBox>
                                                    <br />
                                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator11" runat="server"
                                                        ControlToValidate="Question" Display="Dynamic" ErrorMessage="Question is required."
                                                        ToolTip="Question is required." ValidationGroup="AddTeacher"><span class="err I18N">error.messages.Question is required</span></asp:RequiredFieldValidator>
                                                </td>

                                                <td>
                                                    <asp:Label ID="LblAnswer" CssClass="lblStyle I18N" runat="server">form.data.Answer</asp:Label>
                                                    <br />
                                                    <br />
                                                    <asp:TextBox runat="server" ID="Answer" TextMode="SingleLine" CssClass="txt" placeholder="Answer"></asp:TextBox>
                                                    <br />
                                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator13" runat="server"
                                                        ControlToValidate="Answer" Display="Dynamic" ErrorMessage="Answer is required."
                                                        ToolTip="Answer is required." ValidationGroup="AddTeacher"><span class="err I18N">error.messages.Answer is required</span></asp:RequiredFieldValidator>
                                                </td>

                                            </tr>

                                            <tr>

                                                <td>

                                                    <asp:CompareValidator ID="PasswordCompare" runat="server"
                                                        ControlToValidate="ConfirmPassword" ControlToCompare="Password" Display="Dynamic" ErrorMessage="The Password and Confirmation Password must match."
                                                        ToolTip="The Password and Confirmation Password must match." ValidationGroup="AddTeacher"><span class="err I18N">error.messages.PasswordMsg</span></asp:CompareValidator>
                                                </td>

                                            </tr>

                                        </table>
                                    </td>
                                </tr>
                            </table>
                        </ContentTemplate>
                    </asp:CreateUserWizardStep>
                    <asp:CompleteWizardStep ID="CompleteWizardStep1" runat="server">
                    </asp:CompleteWizardStep>
                </WizardSteps>
                <NavigationButtonStyle CssClass="navigateButton" />
                <HeaderStyle BackColor="White" BorderColor="#FFFBD6" BorderStyle="Solid" BorderWidth="2px"
                    Font-Bold="True" Font-Size="0.9em" ForeColor="#333333" HorizontalAlign="Center" />
                <CreateUserButtonStyle CssClass="navigateButton" />
                <ContinueButtonStyle CssClass="navigateButton" />
                <SideBarStyle BackColor="White" Font-Size="0.9em" VerticalAlign="Top" />
                <TitleTextStyle BackColor="White" Font-Bold="True" ForeColor="White" />
                <SideBarButtonStyle CssClass="navigateButton" />
            </asp:CreateUserWizard>

1 个答案:

答案 0 :(得分:0)

可能有两件事:

您可以尝试使用FinishDestinationPageUrl控件的CreateUserWizard属性。尝试设置为空。

另一个是你应该处理FinishButtonClick事件 单击完成按钮时会触发此操作。基本上在那里实现自己的逻辑。因此,您可以防止默认行为。