<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="WebApplication1.Admin.Login" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div style="margin: 200px;"> <table align ="center" class="style1" style="border :1px ridge #999999; width: 450px;"> <tr> <td align="center" colspan="2"> <asp:Label ID="Label1" runat="server" Text="Shopping Adminpanel" ForeColor="Blue" style="font-family: Aharoni"></asp:Label> <hr /> </td> </tr> <tr> <td align="center" style="width: 50%;"> LoginID : </td> <td style="width: 50%;"> <asp:TextBox ID="txtLoginId" runat="server"></asp:TextBox> </td> </tr> <tr> <td align ="center"style="width: 50%;"> Password : </td> <td style="width: 50%;"> <asp:TextBox ID="txtPassword" runat="server" TextMode="Password"></asp:TextBox> </td> </tr> <tr> <td align ="center"style="width: 50%;"> </td> <td style="width: 50%;"> <asp:Button ID="btnLogin" runat="server" Text="Login" onclick="btnLogin_Click" ></asp:Button> </td> </tr> <tr> <td align="center" colspan="2"> <hr /> <asp:Label ID="lblAlert" runat="server" ForeColor="Red" style="font-family: Aharoni" ></asp:Label> </td> </tr> </table> </div> </form> </body> </html>
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.Configuration; namespace WebApplication1.Admin { public partial class Login : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { txtLoginId.Focus(); } protected void btnLogin_Click(object sender, EventArgs e) { string LoginID = WebConfigurationManager.AppSettings["AdminLoginId"]; string Password = WebConfigurationManager.AppSettings["AdminPassword"]; if (txtLoginId.Text == LoginID && txtPassword.Text == Password) { Session["shopping"] = "shopping"; Response.Redirect("~/Admin/AddNewProducts.aspx"); } else { lblAlert.Text = "Incorrect Login/Password"; } } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)