locked
I am unable to redirect my page to registration page when i click on the Register Hyperlink in my Login.aspx page using asp.net c# ! can someone help me out with this problem ! i am posting the code here as well ! RRS feed

  • General discussion

  • Register.aspx

    ------------------------------------------------------------------------

    <%@ Page Title="Register" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
        CodeBehind="Register.aspx.cs" Inherits="EMRSystems.Account.Register" %>

    <asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
    </asp:Content>
    <asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
        <asp:CreateUserWizard ID="RegisterUser" runat="server" EnableViewState="false" OnCreatedUser="RegisterUser_CreatedUser">
            <LayoutTemplate>
                <asp:PlaceHolder ID="wizardStepPlaceholder" runat="server"></asp:PlaceHolder>
                <asp:PlaceHolder ID="navigationPlaceholder" runat="server"></asp:PlaceHolder>
            </LayoutTemplate>
            <WizardSteps>
                <asp:CreateUserWizardStep ID="RegisterUserWizardStep" runat="server">
                    <ContentTemplate>
                        <h2>
                            Create a New Account
                        </h2>
                        <p>
                            Use the form below to create a new account.
                        </p>
                        <p>
                            Passwords are required to be a minimum of <%= Membership.MinRequiredPasswordLength %> characters in length.
                        </p>
                        <span class="failureNotification">
                            <asp:Literal ID="ErrorMessage" runat="server"></asp:Literal>
                        </span>
                        <asp:ValidationSummary ID="RegisterUserValidationSummary" runat="server" CssClass="failureNotification"
                             ValidationGroup="RegisterUserValidationGroup"/>
                        <div class="accountInfo">
                            <fieldset class="register">
                                <legend>Account Information</legend>
                                <p>
                                    <asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName">User Name:</asp:Label>
                                    <asp:TextBox ID="UserName" runat="server" CssClass="textEntry"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="UserNameRequired" runat="server" ControlToValidate="UserName"
                                         CssClass="failureNotification" ErrorMessage="User Name is required." ToolTip="User Name is required."
                                         ValidationGroup="RegisterUserValidationGroup">*</asp:RequiredFieldValidator>
                                </p>
                                <p>
                                    <asp:Label ID="EmailLabel" runat="server" AssociatedControlID="Email">E-mail:</asp:Label>
                                    <asp:TextBox ID="Email" runat="server" CssClass="textEntry"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="EmailRequired" runat="server" ControlToValidate="Email"
                                         CssClass="failureNotification" ErrorMessage="E-mail is required." ToolTip="E-mail is required."
                                         ValidationGroup="RegisterUserValidationGroup">*</asp:RequiredFieldValidator>
                                </p>
                                <p>
                                    <asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password">Password:</asp:Label>
                                    <asp:TextBox ID="Password" runat="server" CssClass="passwordEntry" TextMode="Password"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="PasswordRequired" runat="server" ControlToValidate="Password"
                                         CssClass="failureNotification" ErrorMessage="Password is required." ToolTip="Password is required."
                                         ValidationGroup="RegisterUserValidationGroup">*</asp:RequiredFieldValidator>
                                </p>
                                <p>
                                    <asp:Label ID="ConfirmPasswordLabel" runat="server" AssociatedControlID="ConfirmPassword">Confirm Password:</asp:Label>
                                    <asp:TextBox ID="ConfirmPassword" runat="server" CssClass="passwordEntry" TextMode="Password"></asp:TextBox>
                                    <asp:RequiredFieldValidator ControlToValidate="ConfirmPassword" CssClass="failureNotification" Display="Dynamic"
                                         ErrorMessage="Confirm Password is required." ID="ConfirmPasswordRequired" runat="server"
                                         ToolTip="Confirm Password is required." ValidationGroup="RegisterUserValidationGroup">*</asp:RequiredFieldValidator>
                                    <asp:CompareValidator ID="PasswordCompare" runat="server" ControlToCompare="Password" ControlToValidate="ConfirmPassword"
                                         CssClass="failureNotification" Display="Dynamic" ErrorMessage="The Password and Confirmation Password must match."
                                         ValidationGroup="RegisterUserValidationGroup">*</asp:CompareValidator>
                                </p>
                            </fieldset>
                            <p class="submitButton">
                                <asp:Button ID="CreateUserButton" runat="server" CommandName="MoveNext" Text="Create User"
                                     ValidationGroup="RegisterUserValidationGroup"/>
                            </p>
                        </div>
                    </ContentTemplate>
                    <CustomNavigationTemplate>
                    </CustomNavigationTemplate>
                </asp:CreateUserWizardStep>
            </WizardSteps>
        </asp:CreateUserWizard>
    </asp:Content>
    --------------------------------------------------------------------------------------------------------------------------------------------------------

    --------------------------------------------------------------------------------------------------------------------------------------------------------

    Login.aspx

    -------------------------------------------------------------------



    <%@ Page Title = "Log In" Language ="C#" MasterPageFile ="~/Site.master" AutoEventWireup="false"
    CodeBehind="Login.aspx.cs" Inherits="EMRSystems.Account.Login" %>

    <asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
    </asp:Content>
    <asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
        <h2>
            Log In
        </h2>
        <p>
            Please enter your username and password.
            <asp:HyperLink ID="RegisterHyperLink" runat="server" NavigateUrl="\Account\Register.aspx" >Register</asp:HyperLink> if you don't have an account.
        </p>
        <asp:Login ID="LoginUser" runat="server" EnableViewState="false" RenderOuterTable="false">
            <LayoutTemplate>
                <span class="failureNotification">
                    <asp:Literal ID="FailureText" runat="server"></asp:Literal>
                </span>
                <asp:ValidationSummary ID="LoginUserValidationSummary" runat="server" CssClass="failureNotification"
                     ValidationGroup="LoginUserValidationGroup"/>
                <div class="accountInfo">
                    <fieldset class="login">
                        <legend>Account Information</legend>
                        <p>
                            <asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName">Username:</asp:Label>
                            <asp:TextBox ID="UserName" runat="server" CssClass="textEntry"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="UserNameRequired" runat="server" ControlToValidate="UserName"
                                 CssClass="failureNotification" ErrorMessage="User Name is required." ToolTip="User Name is required."
                                 ValidationGroup="LoginUserValidationGroup">*</asp:RequiredFieldValidator>
                        </p>
                        <p>
                            <asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password">Password:</asp:Label>
                            <asp:TextBox ID="Password" runat="server" CssClass="passwordEntry" TextMode="Password"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="PasswordRequired" runat="server" ControlToValidate="Password"
                                 CssClass="failureNotification" ErrorMessage="Password is required." ToolTip="Password is required."
                                 ValidationGroup="LoginUserValidationGroup">*</asp:RequiredFieldValidator>
                        </p>
                        <p>
                            <asp:CheckBox ID="RememberMe" runat="server"/>
                            <asp:Label ID="RememberMeLabel" runat="server" AssociatedControlID="RememberMe" CssClass="inline">Keep me logged in</asp:Label>
                        </p>
                    </fieldset>
                    <p class="submitButton">
                        <asp:Button ID="LoginButton" runat="server" CommandName="Login" Text="Log In" ValidationGroup="LoginUserValidationGroup"/>
                    </p>
                </div>
            </LayoutTemplate>
        </asp:Login>
    </asp:Content>

    • Edited by zarus_sz Saturday, May 12, 2012 1:35 PM
    Saturday, May 12, 2012 1:32 PM

All replies

  • hey zarus, perhaps this tutorial can help you out...

    tutorial

    normally you should code it as 

    response.redirect ("Login.aspx")

    • Edited by Tech_ Wednesday, October 24, 2012 4:59 PM adding info
    Wednesday, October 24, 2012 4:57 PM
  • This probably isn't the best forum for this question. It would probably get more relevant answers if you posted it in the ASP.NET forum.

    Edit: It appears there is no ASP.NET forum here. So here are the actual ASP.NET site forums:

    http://forums.asp.net/

    Monday, October 29, 2012 7:29 PM
  • Hi

    Can you try this

          <asp:HyperLink ID="RegisterHyperLink" runat="server" NavigateUrl="~\Register.aspxTarget="_blank">Register</asp:HyperLink> 

    Regards

    Dominic


    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful


    Wednesday, November 7, 2012 12:04 PM