Please help me how I create the login form using c# in asp.net

take the idea from the following code:

using System;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Data.OleDb;

public partial class _Default : System.Web.UI.Page 
{
    //OleDbConnection con = new OleDbConnection(ConfigurationSettings .AppSettings ["conn"]);
    OleDbConnection con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\WebSite\\Registration\\App_Data\\web.mdb;Persist Security Info=True");
    
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (TextBox1.Text.Equals ("") || TextBox2.Text.Equals ("") )
        {
            Response.Write("Fill User name and password");
        }
        else 
        {
            string sel = "select *from signup where user_id='" + TextBox1.Text.ToString() + "'";
            OleDbDataAdapter oda = new OleDbDataAdapter(sel, con);
            DataTable dt = new DataTable();
            oda.Fill(dt);
            string du = dt.Rows[0]["user_id"].ToString();
            string dp = dt.Rows[0]["password"].ToString();
            string tu = TextBox1.Text.ToString();
            string tp = TextBox2.Text.ToString();
            if (du.Equals(tu) && dp.Equals(tp))
            {
                Session["ses"] = TextBox1.Text;
                Response.Redirect("detail.aspx");
            }
            else
            {
               Response.Write("Invalid User name or password");
            }

        }
        
    }
}

hi,
this is a simple login script
try this

<html>
<head>
SCRIPT LANGUAGE="Javascript">




var COLOR = 999999
var woot = 0
function stoploop() {
document.bgColor = '#000000';
clearTimeout(loopID);
}
function loopBackground() {
if (COLOR > 0) {
document.bgColor = '#' + COLOR
COLOR -= 111111
loopID = setTimeout("loopBackground()",1)
} else {
document.bgColor = '#000000'
woot += 10
COLOR = 999999
COLOR -= woot
loopID = setTimeout("loopBackground()",1)
   }
}


</head>
<body bgcolor="#F8F8FF">



<CENTER>
<FORM NAME="background">
<INPUT TYPE="button" VALUE="Start bgColor WARP"
onClick="loopBackground()">
<br>
<input type="button" value="Stop bgColor WARP" onClick="stoploop()">
</FORM>
</CENTER>


<br><br><br><BR><center><img src="" alt="The Logo" /></center> 

<br><br><script language="javascript">

function pasuser(form) {
if (form.id.value=="") { 
if (form.pass.value=="") {              
location="search.html" 
} else {
alert("Invalid Password")
}
} else {  alert("Invalid UserID")
}
}


<center>
<table bgcolor="#F8F8FF" cellpadding="12" border="0">
<tr><td colspan="2"><center><h1><b>Login
</b></h1></center></td></tr>
<tr><td><h1><i><b>UserID:</b></i></h1></td><td><form name="login"><input
name="id" type="text"></td></tr>
<tr><td><h1><i><b>Password:</b></i></h1></td><td><input name="pass"
type="password"></td></tr>
<tr><td><center><input type="button" value="Login"
onClick="pasuser(this.form)"></center></td><td><Left><br><input
type="Reset"></form></td></tr></table></left>
</body></html>

this is amazing..thank u...

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.