Fail to authenticate using a login control

Hi,
I am using asp.net 3.5 and need to create a very simple way to login to my web site; however, what seemed so simple is not working at all.  Following is what I am doing:
On web.config I have:
    <authentication mode="Forms">
      <forms loginUrl="login.aspx">
        <credentials passwordFormat="Clear">
          <user name="user1" password="user11234"/>
          <user name="user2" password="user21234"/>
        </credentials>
      </forms>
    </authentication>

    <authorization>
      <allow users="user1"/>
      <deny users="*"/>
    </authorization>

In the login.aspx page I placed a "asp:Login" control.

When I go to my web page it shows the Login page; however, it keeps denying the credentials.

Do I need to add some code?

I already tried using the following code on the Login_Authenticate event but did not work:

    protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
    {
        if (Membership.ValidateUser(Login1.UserName, Login1.Password))
        {
            FormsAuthentication.RedirectFromLoginPage(Login1.UserName, false);
        }
    }

rudy2024Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

robastaCommented:
WEB CONFIG:
 <authentication mode="Forms">
       <forms name=".ASPXAUTH" loginUrl="login.aspx" path="/">
          <credentials passwordFormat="Clear">
             <user name="user1" password="user11234"/>
             <user name="user2" password="user21234" />
          </credentials>
       
       </forms>
    </authentication>

    <authorization>
      <allow users="user1"/>
      <deny users="?"/>
    </authorization>

CODE BEHIND:
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
        {
            if (FormsAuthentication.Authenticate(Login1.UserName, Login1.Password))
            {
                e.Authenticated = true;
                FormsAuthentication.RedirectFromLoginPage(Login1.UserName, false);
               
            }
           
        }

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rudy2024Author Commented:
Hi robasta,
I get the following message when I try your solution:
"This application is currently offline. To enable the application, remove the app_offline.htm file from the application root directory. "

I don't have that app_offline.htm in my project.
robastaCommented:
click on 'Show all files' , the second icon at the top of the solution explorer. If you still do not have app_offline, then,

remove path="/"
rudy2024Author Commented:
robasta,
The issue I am seeing right now has to do with my asp.net.
I just installed some updates and rebooted the pc and that may be the cause for the issues.
Anyway, I think your suggestion to add the following in the code behind is what will solve my problem.
Just let me figure out why my asp.net is working and then will probably accept your solution:
rudy2024Author Commented:
Thank you for your quick and accurate solution, it worked great!
BTW, I did have that offline file. I just didn't see it before.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Anti-Virus Apps

From novice to tech pro — start learning today.