CREATE TABLE User
(
UserID int IDENTITY PRIMARY KEY,
UserName varchar(50) NOT NULL,
UserPwd varchar(15) NOT NULL
)
You can then query this table from your page and use the
FormsAuthentication.RedirectFromLoginPage(userName, persistCookie) to
redirect them back to the default page.
It is better if you set encryption, but accessing the table to check for a
user is rather simple. For performance you can do the query like:
CREATE PROCEDURE [dbo].[CheckUser]
(
@UserName varchar(50)
, @UserPwd varchar(15)
)
AS
SELECT UserName FROM User
WHERE UserName = @UserName
AND UserPwd = @UserPwd
You can then use ExecuteScalar like so:
string userName = cmd.ExecuteScalar();
This will reduce the amount of info pulled.
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
**********************************************************************
Think Outside the Box!
**********************************************************************
Brent Burkart said:
I want to protect my website with a user and password. I have SQL Server
2000 where I want to store the users and passwords and the website is
complete. I just need to add in some security with password protection.
Can anyone help me out?