how do wrote coding the login control

Dani AI

Generated

This thread began with asking how to "write coding the login control." Replies from , , , and pointed to tutorials; the following is a concise, practical complement that shows the minimal wiring for classic ASP.NET Web Forms and highlights current security guidance.

A minimal Web Forms flow: enable Forms Authentication, place a Login control on the page, validate credentials (Membership API or custom store), and issue the auth cookie. Example fragments:

<!-- web.config -->
<configuration>
  <system.web>
    <authentication mode="Forms">
      <forms loginUrl="~/Login.aspx" timeout="30" />
    </authentication>
  </system.web>
</configuration>
<!-- Login.aspx -->
<asp:Login ID="Login1" runat="server" OnAuthenticate="Login1_Authenticate" />
/* Login.aspx.cs */
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
{
    if (Membership.ValidateUser(Login1.UserName, Login1.Password))
    {
        e.Authenticated = true;
        FormsAuthentication.RedirectFromLoginPage(Login1.UserName, Login1.RememberMeSet);
    }
    else
    {
        e.Authenticated = false;
    }
}

Security and modern guidance: always use HTTPS, store passwords hashed+salted (avoid plain text), implement lockout/brute‑force protections, and prefer current frameworks for new projects. For new applications migrate to ASP.NET Core Identity (ASP.NET Core Identity docs) and follow OWASP guidance on password storage (Password Storage Cheat Sheet).

Recommended Answers

All 4 Replies

Please Refer..

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.