vuyiswamb 17 Posting Whiz

Good Afternoon All

In all my Application, i used to write my login screen and i will not have a problem. i have inherited the ASP.NET Application that uses a login control.
Below are the pics of how it looks

here is a code for Forget Password link

protected void btnForgot_Click(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {

            PasswordRecovery1.Focus();

            multiviewLogin.ActiveViewIndex = 1;

            if (Login1.UserName != "")
            {
                PasswordRecovery1.UserName = Login1.UserName;
            }
        }
    }

and for Change Password code

protected void btnChangePassword_Click(object sender, EventArgs e)
    {
        ChangePassword1.Visible = true;
        if (Login1.UserName != "")
        {
            PasswordRecovery1.UserName = Login1.UserName;
        }
        
    }

Now my Problem is that when a user enters a username and password that are correct, and Click the "Forgot Password" button , it logged teh user in the system. It is doing the same thing as the "Change Password". But if i Crear the Username and Password textbox in the Login control it goes to the right place. So i have tried to crear them when the "Forgot Password Button is clicked and set them to empty strings, well for username its working, but for password i get an error that says the property is a Readonly

i tried to do them like this

if (!Page.IsPostBack)
        {
            /*Vuyiswa Added this to Prevent the Page from Bypassing the Login screen.
             * This was a bug Reporeted by University of freestate*/
            if (Login1.UserName != "")
            {

[B]                Login1.UserName = "";

                Login1.Password = "";[/B]
            }
            PasswordRecovery1.Focus();

            multiviewLogin.ActiveViewIndex = 1;

            if (Login1.UserName != "")
            {
                PasswordRecovery1.UserName = Login1.UserName;
            }

What is the Problem

Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.