Click here to Skip to main content
15,919,132 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more: (untagged)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
namespace logindemo
{
public partial class login : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}

protected void TextBox1_TextChanged(object sender, EventArgs e)
{

}

protected void Button1_Click(object sender, EventArgs e)
{
string connetionString = "Data Source=INFND-DTP-023;Initial Catalog=Test_DB;User ID=alo;Password=abcd@1234";
SqlConnection conn = new
SqlConnection(connetionString);
conn.Open();
string commText = "Select * from login where User_name='" + TextBox1.Text.Trim() + "' and Password='" + TextBox2.Text.Trim() + "'";
SqlCommand cmd =new
SqlCommand(commText, conn);
SqlDataReader dr = cmd.ExecuteReader();

if (!dr.Read())
{
Response.Write("Invalid User");
}
else
{
conn.Close();
Response.Redirect("~/welcometo.aspx");
}

}

protected void Button2_Click(object sender, EventArgs e)
{
TextBox1.Text = String.Empty;
TextBox2.Text = String.Empty;
}

protected void Button3_Click(object sender, EventArgs e)
{
Response.Redirect("~/Register.aspx");
}
}
}
Posted
Updated 19-Mar-15 18:49pm
v2
Comments
[no name] 20-Mar-15 0:48am    
There's zero code there that deals with sending an email. You don't even show the email address where the email is supposed to be sent to. You could have as well presented no code at all. And you expect us to write the emailing-code for you?
.net bigner 20-Mar-15 1:04am    
Auto generated mail will go to these people when they login by username and password. Then mail will send from mail in admin@gmail.com. Mail will send to this people who have already register before by registration form. there Email id has accepted by textbox id= txtEmailId.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900