Listing 1

using System;

namespace WebLogging.Entity
{
	/// <summary>
	/// UserEntity to store user
       ///  specific information
	/// </summary>
	public class UserEntity
	{
	private String loginId;
	private String password;

	public UserEntity()
	{
	}

	public String LoginId
	{
		get { return loginId; }
		set { loginId = value;}
	}

	public String Password
	{
		get { return password; }
		set { password = value;}
	}
     }
}


Listing 2

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using log4net;
using WebLogging.Entity;

namespace WebLogging
{

/// <summary>
/// Login Module Implementation
/// </summary>
public class Login : System.Web.UI.Page
{
   private static readonly ILog log = LogManager.GetLogger(typeof (Login));

   protected
        System.Web.UI.WebControls.TextBox txtLoginId;

   protected
        System.Web.UI.WebControls.TextBox txtPassword;

   protected 
        System.Web.UI.WebControls.Label lblLoginId;

   protected 
        System.Web.UI.WebControls.Label lblPassword;

   protected 
        System.Web.UI.WebControls.Button btnSignOn;

   private ArrayList userList = new ArrayList();

   private String pvtPassword = null;




   private void Page_Load(object sender, System.EventArgs e)
   {
        log.Info("Preparing user-" + "password list into the " + "memory");
	UserEntity user1 = new 
                            UserEntity();

	UserEntity user2 = new 
                            UserEntity();

	UserEntity user3 = new 
                            UserEntity();

	UserEntity user4 = new 
                            UserEntity();

	log.Debug("Add sonny user to the" + "list");

	user1.LoginId = "sonny";

	user1.Password = "password1";
			userList.Add(user1);

	log.Debug("Add fonny user to the" + "list");
	user2.LoginId = "fonny";
	user2.Password = "password2";
			userList.Add(user2);

	log.Debug("Add mario user to the" + "list");
	user3.LoginId = "mario";
	user3.Password = "password3";
			userList.Add(user3);

	log.Debug("Add darius user to" + "the list");
	user4.LoginId = "darius";
	user4.Password = "password4";
			userList.Add(user4);
      }



#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
			InitializeComponent();
	base.OnInit(e);
}



private void InitializeComponent()
{
	this.btnSignOn.Click += new System.EventHandler(this.btnSignOn_Click);
	this.Load += new System.EventHandler(this.Page_Load);

}
#endregion




  private bool AuthenticateLogin(String loginId)
  {
	log.Info("for each user in" +	"the list check wether" + "the login id exist");
	
        Object[] users = userList.ToArray();

	for (int i = 0;i < users.Length;
            i++)
	{	
             log.Debug("verifying user" + "list no " + i);
   	      if
                 (((UserEntity)users[i]).
                  LoginId == loginId) 
	      {

            	pvtPassword = ((UserEntity)users[i]).Password;

              log.Debug("user list no " + i + " match with" + "login id");

 	       return true;
	      }
	}
	return false;
    }



    private bool
        AuthenticatePassword(String password)
    {
	if (pvtPassword != null)
	{
	  if (password == pvtPassword)
	  {					    log.Debug("Password match");
            return true;
	  }
	}
	return false;
     }

     private void btnSignOn_Click(object sender, System.EventArgs e)
     {
	try
	{
		    
           log.Info("Authenticate login" + "id");
  	   if (AuthenticateLogin(txtLoginId.Text))
	   {
			
             log.Info("Authenticate + "password");

	      if (AuthenticatePassword(txtPassword.Text))
 	      {
						        log.Info("Access" + "Granted");
	
	      }
              else
             {
	
                log.Warn("Access denied " + "Password" + " doesn't" + "match");
  	      }
	    }
	    else
 	    {
		   
               log.Warn("Access denied" + " Login id" + "not exist");
	    }
	}
       catch (Exception ex)
	{

 	    log.Error("Error occurred" + "while sign on" + "request",ex);
	}
     }
  }
}