Below is code for a login... But I keep getting errors on the namespacing...
asp code:
<%@ Page Language="C#" MasterPageFile="~/MasterPage3.master" AutoEventWireup="true" CodeFile="Login.aspx.cs" Inherits="Edcc" Title="SignOn" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder2" runat="Server">
<form action="Login.aspx" method="post" runat="server">
<p align="center" style=font-size:xx-large>
East Divisional Call Center</p>
<p align="center">
<asp:Label ID="Message" runat="server"></asp:Label>
</p>
<h3 align="center">Login Form</h3>
<div align="center">
Login:<asp:TextBox ID="txtLogin" Width="200" runat="server" />
<asp:RequiredFieldValidator ControlToValidate="txtLogin" Display="Static" Font-Names="Verdana, arial, sans-serif"
ForeColor="red" Font-Size="9pt" ErrorMessage="Incorrect UserId Entered." runat="server"
ID="RFVLogin" />
<p>
Password:<asp:TextBox ID="txtPassword" Width="200" runat="server" TextMode="Password" />
<asp:RequiredFieldValidator ControlToValidate="txtPassword" Display="Static" Font-Names="Verdana, arial, sans-serif"
ForeColor="red" Font-Size="9pt" ErrorMessage="Incorrect Password Entered." runat="server"
ID="RFVPassword"></asp:RequiredFieldValidator>
</div>
<div align="center" >
<asp:Button ID="btnSignIn" runat="server" Text="Sign In" OnClick="btnSignIn_Click" Width="64px" />
</div>
</form>
</asp:Content>
Code Behind:
using System;
using System.Data;
using System.Data.Sql;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.SessionState;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public class Login : System.Web.UI.Page
{
public System.Web.UI.WebControls.Label Message;
public System.Web.UI.HtmlControls.HtmlTable tblSignIn;
public System.Web.UI.WebControls.TextBox txtLogin;
public System.Web.UI.WebControls.RequiredFieldValidator RFVLogin;
public System.Web.UI.WebControls.TextBox txtPassword;
public System.Web.UI.WebControls.RequiredFieldValidator RFVPassword;
public System.Web.UI.WebControls.Button btnSignIn;
protected void Page_Load(object sender, EventArgs e)
{
if ( !IsPostBack )
{
//Display welcome message
Message.Text = "Enter your login and password.";
}
}
protected void btnSignIn_Click(Object obj, EventArgs e)
{
if(Page.IsValid)
{
//Check username/password against Emp_DB_Employee database
SQLConnection conn = new
SQLConnection("server=localhost;uid=sa;pwd=;database=Login");
//get row back based on username/password
string strsql = "Select * from Emp_DB_Employee where Id='" +
txtLogin.Text + "' and Password = '" +
txtPassword.Text + "'";
SQLDataSetCommand dsc = new SQLDataSetCommand(strsql, conn);
//populate a dataset with SQL results
DataSet ds = new DataSet ();
dsc.FillDataSet(ds, "Emp_DB_Employee" );
//check to see if the dataset contains no rows (if it is EOF) user is invalid
if(ds.Tables ["Emp_DB_Employee"].Rows.Count ==0)
{
Message.Text = "Invalid User Name and Password. Try Again.";
}else{
Message.Text = "Congratulations, " + txtLogin.Text +
"!!! You have successfully signed in.";
}
}
}
}
this is the error I keep getting??????
Error 4 Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl). C:\_Programming\Website Testing\Gina WebSite\Login.aspx.cs 1 33 C:\...\Gina WebSite\
Thank you for any help you can give
Gina