Im developing a website for a company and it is my first time to use ASP.net in c# language. I am expert in graphic designs but slow on programming. please help me how to create a login page using in ASP.NET using c#. :)

thanks

Dani AI

Generated

For a quick, reliable login on ASP.NET 2.0 (exactly the situation described), the simplest path is to use the built‑in Login UI plus the Membership API and Forms authentication. That avoids most manual plumbing: the Login control gives a ready form, the Membership provider handles hashing/reset, and Forms authentication handles cookies/redirects. was right that a short tutorial helps; also flagged the main choice: use Windows auth only for intranets/AD scenarios, otherwise use Forms for public sites.

A minimal workflow:

  1. Add a page (Login.aspx) and drop the ASP.NET Login control (or use custom fields).
  2. Provision a membership database (run the ASP.NET SQL registration tool that comes with .NET 2.0 to create the tables).
  3. Configure web.config for authentication and membership and add a connection string.
  4. Use Membership.ValidateUser(...) + FormsAuthentication on success, or let the Login control wire it automatically.

Example snippets (ASP.NET 2.0):

<!-- web.config (trimmed) -->
<system.web>
  <authentication mode="Forms">
    <forms loginUrl="~/Login.aspx" timeout="30" />
  </authentication>

  <membership defaultProvider="AspNetSqlMembershipProvider">
    <providers>
      <add name="AspNetSqlMembershipProvider"
           type="System.Web.Security.SqlMembershipProvider"
           connectionStringName="ApplicationServices"
           passwordFormat="Hashed" />
    </providers>
  </membership>
</system.web>
/* Login button handler (code-behind) */
if (Membership.ValidateUser(Login.UserName, Login.Password))
{
  FormsAuthentication.RedirectFromLoginPage(Login.UserName, Login.RememberMeSet);
}
else
{
  FailureText.Text = "Invalid username or password.";
}

Practical cautions: always serve the login page over HTTPS, never store plaintext passwords (use the Membership provider or hashed+salted storage), and prefer parameterized queries for custom auth. For new projects, consider moving to modern tooling (ASP.NET Core) when feasible. This thread drifted (see ) and was closed by , but the above gives a concise, applied path for getting a secure ASP.NET 2.0 login working.

Recommended Answers

All 5 Replies

Great! thank you very much tycoon!

you can search on Windows authentication and forms authentication , the authentication and authorization can be achieved in pure way in pro-grammatically way or you can use your programming skills associated withe the helpful tags at the Web.config

This thread was happily sleeping in 2007 before Niluk decided to hijack and resurrect it for a completely unrelated question.

I'm going to close it here since I imagine the OP has solved his question.

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.