Aim of the project
The basic aim of this project is store criminal record , search criminal record and find current location of the criminal.
Security of the project :
Project contain username and password field for security with proper validation (client side and server side validation) . Project security screen shot is
The basic aim of this project is store criminal record , search criminal record and find current location of the criminal.
Security of the project :
Project contain username and password field for security with proper validation (client side and server side validation) . Project security screen shot is
<p>
<h2>Login for security</h2></p>
<asp:ValidationSummary ID="ValidationSummary1" runat="server" BackColor="#CCCC00" BorderColor="Black" BorderStyle="Solid" BorderWidth="4px" />
<p>
Enter member username :
<asp:TextBox ID="usrtxt" runat="server" Width="182px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="usrtxt" ErrorMessage="Enter Username" ForeColor="Maroon">*</asp:RequiredFieldValidator>
</p>
<p>
Enter member password : <asp:TextBox ID="pwd" runat="server" TextMode="Password" Width="182px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="usrtxt" ErrorMessage="Enter password" ForeColor="Maroon">*</asp:RequiredFieldValidator>
</p>
<p>
<asp:Button ID="Button1" runat="server" Text="Member Login" OnClick="Button1_Click" />
</p>
<p>
<asp:Label ID="Label1" runat="server"></asp:Label>
Code behind code <h2>Login for security</h2></p>
<asp:ValidationSummary ID="ValidationSummary1" runat="server" BackColor="#CCCC00" BorderColor="Black" BorderStyle="Solid" BorderWidth="4px" />
<p>
Enter member username :
<asp:TextBox ID="usrtxt" runat="server" Width="182px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="usrtxt" ErrorMessage="Enter Username" ForeColor="Maroon">*</asp:RequiredFieldValidator>
</p>
<p>
Enter member password : <asp:TextBox ID="pwd" runat="server" TextMode="Password" Width="182px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="usrtxt" ErrorMessage="Enter password" ForeColor="Maroon">*</asp:RequiredFieldValidator>
</p>
<p>
<asp:Button ID="Button1" runat="server" Text="Member Login" OnClick="Button1_Click" />
</p>
<p>
<asp:Label ID="Label1" runat="server"></asp:Label>
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;
using System.Data;
using System.Configuration;
public partial class welcome : System.Web.UI.Page
{
SqlDataReader rd;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
bool flag=true ;
using (SqlConnection con = new SqlConnection())
{
con.ConnectionString =ConfigurationManager .ConnectionStrings ["ConnectionString"].ToString ();
con.Open ();
using (SqlCommand cmd=new SqlCommand ())
{
cmd.CommandText ="select * from [Table]";
cmd.Connection =con;
rd=cmd.ExecuteReader (CommandBehavior .CloseConnection);
while (rd.Read ())
{
if (rd["username"].ToString ().Equals(usrtxt .Text) && rd["password"].ToString ().Equals (pwd .Text))
{
flag =false ;
Session ["username"]=rd["username"].ToString ();
break ;
}
}
if (flag ==true)
Label1 .Text ="No record found";
else
Response .Redirect ("~/admin/securepage.aspx");
}
}
}
}
Software requirements of the project are:using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;
public partial class welcome : System.Web.UI.Page
{
SqlDataReader rd;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
bool flag=true ;
using (SqlConnection con = new SqlConnection())
{
con.ConnectionString =ConfigurationManager .ConnectionStrings ["ConnectionString"].ToString ();
con.Open ();
using (SqlCommand cmd=new SqlCommand ())
{
cmd.CommandText ="select * from [Table]";
cmd.Connection =con;
rd=cmd.ExecuteReader (CommandBehavior .CloseConnection);
while (rd.Read ())
{
if (rd["username"].ToString ().Equals(usrtxt .Text) && rd["password"].ToString ().Equals (pwd .Text))
{
flag =false ;
Session ["username"]=rd["username"].ToString ();
break ;
}
}
if (flag ==true)
Label1 .Text ="No record found";
else
Response .Redirect ("~/admin/securepage.aspx");
}
}
}
}
- Visual studio 2013
- Open website in visual studio 2013
- Run your project
- ByDefault your username and password are : admin and admin
Tidak ada komentar:
Posting Komentar