using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Drawing;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
//Check the password or UserName field is empty
if (TextBoxUsername.Text == "" && TextBoxPassword.Text == "")
{
Response.Write("<script LANGUAGE='JavaScript' >alert('You are an UnAuthorized person')</script>");
//LabelValid.Text="You are an UnAuthorized person";
}
//check the user is admin
else if (TextBoxUsername.Text == "Admin" && TextBoxPassword.Text == "Admin")
{
Session["name"] = TextBoxUsername.Text;
Response.Redirect("Admin.aspx");
}
//code for the users
else if (TextBoxUsername.Text != "" && TextBoxPassword.Text != "")
{
Session["name"] = TextBoxUsername.Text;
Response.Redirect("UserPage.aspx");
}
else
{
Label3.Text = "Please enter the UserName and Password";
this.Label3.ForeColor = Color.Red;
}
}
}
LogOut.aspx