Lost universe of Programing

USERNAME :- Guest Forum Post:-114
 
HomePortalGalleryRegisterLog in

Share | 
 

 CODE FOR LOGIN PAGE In C#

Go down 
AuthorMessage
Hacker.of.heart



Male
Number of posts : 2
Age : 32
Registration date : 2008-01-07

PostSubject: CODE FOR LOGIN PAGE In C#   1/8/2008, 2:27 am

Surprised


Quote :

To Design a Login page in C# Following thing Should be keep in mind

1.User Name Should Be unique and case sensitive, It Should Not contains LITERALS LIKE (!@#$%^&*()_ |)
2. Password Should Be Different or Same Depending upon the SRS but it should be case sensitive.
3.It Should have Reset button, Used if Password is forgot bye the Employ or candidate
4.Login button to loged into the account
5. cancel button if u enter the Wrong User Name and Password
6. A label Should Be there So that if Username or Password wrong then It Tell Which entry is Wrong


WARNING: USING PROCEDURE.....

CODE iN CODEBEHIND
protected void But_Login_Click(object sender, EventArgs e)
{
// Is used to set up a connection With sql server

SqlConnection Connection = new SqlConnection("server=(LOCAL);Initial catalog =OnlineExamination;integrated Security=sspi");
Connection.Open();

if (Txt_UserName.Text == "" Txt_UserName == null)
{
Lb_UserName.Visible = true;
Lb_UserName.Text = "Enter The UserName";
}
else
{
// getting the value from sql server

SqlCommand Command = new SqlCommand("sp_Login", Connection);
Command.CommandType = CommandType.StoredProcedure;
Command.Parameters.Add(new SqlParameter("@UserName_in", Txt_UserName.Text));
Command.Parameters.Add(new SqlParameter("@Password_in", Txt_Password.Text));
DataSet Ds = new DataSet();
SqlDataAdapter DA = new SqlDataAdapter(Command);
DA.Fill(Ds);
if (Txt_Password.Text == "")
{
Lb_UserName.Visible = true;
Lb_UserName.Text = "Enter The Password";
}
else
{
if (Convert.ToInt16(Ds.Tables[0].Rows[0][0]) == 2)
{
Lb_UserName.Visible = true;
Lb_UserName.Text = "UserName Does Not Match";
}
else
{
if (Ds.Tables[0].Rows[0][2].ToString() == Txt_Password.Text.ToString())
{
if (Convert.ToInt16(Ds.Tables[0].Rows[0][0]) == 1)
{
if (Convert.ToInt16(Ds.Tables[0].Rows[0][1]) == 1)
{
Session["Login"] = 1;
Session["Flag"] = Ds.Tables[0].Rows[0][1];
Response.Redirect("Examination.aspx");
}
else
{
Session["Login"] = 1;
Session["Flag"] = Ds.Tables[0].Rows[0][1];
Response.Redirect("Menu.aspx");
} } }
else
{
Lb_UserName.Visible = true;
Lb_UserName.Text = "Password Does Not Match";
} } } }

}

// But_Cancel_Click(object sender, EventArgs e) This Methord tells the function of the Cancel button

protected void But_Cancel_Click(object sender, EventArgs e)
{
Response.Redirect("Login.aspx");
}


// LB_RsetPassword_Click(object sender, EventArgs e) This Methord tells the function of the reset button

protected void LB_RsetPassword_Click(object sender, EventArgs e)
{
Session["Login"] = 1;
Response.Redirect("In_ChangePassword.aspx");
}
Back to top Go down
View user profile
 
CODE FOR LOGIN PAGE In C#
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Lost universe of Programing :: --=| SOURCE CODE |=-- :: CODE FOR C# & ASP.NET-
Jump to: