Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Dear Code project Team,

In Business Layer under (3 tier architecture) how i implement Procedure and login form authentication login with connectivity of presentation layer.

Please description<b> how i can use login authentication in business layer</b>. And Login use in business layer.

Please help me.

Thanks
Rohit kumar Singh
9810353598
Posted
Updated 26-Jun-11 23:41pm
v2

1 solution

Presentation Layer - get and pass the credentials to the Business Logic Layer
Business Logic Layer - validate the credentials (using either LDAP/ custom authentications from DB). After validation, you may decide to store the output to a session, which will be shared among all the pages.
Data Access Layer - use it to pull the respective credentials from DB (if you use your custom authentication)


A simple solution.

Website Project
1. Login.aspx.cs

public void btnLogin_click()
{
    //get both username & password and store it in string variables

    LoginControlClass logClass = new LoginControlClass();
logClass.IsAuthenticatedUser(userName, password);
}



BLL (Class Library)

public class LoginControlClass
{

   public bool IsAuthenticatedUser(string userName, string password)
   {
     //put in your logic to authenticate.
//If LDAP, get details from LDAP to validate uname/password
//If custom, then invoke data from DAL to validate username/ password.
LoginDal loginDal = new LoginDal();
User user = loginDal.RetrieveUserCredentials(userName, password);
//Check the variable inside user object to determine the authentication status.

 }


}


DAL (Class Library)
public class LoginDal
{
  public User RetrieveUserCredentials()
  {
//Query from DB to prepare User object. This can be a DTO. Remember not to save the password in User object, instead you may think of set the validated authentication result in a variable.
}

}



Cheers
- Balaji
 
Share this answer
 
v3
Comments
[no name] 27-Jun-11 5:45am    
Good Call. My 5 too.
Prerak Patel 27-Jun-11 6:59am    
Comment by OP:
[OP posted a new question instead.]

This Answer not satified to me.
Please give real example on project base. And How to flow to presentation layer to business layer to data acces layer with project example.

Presentation Layer - get and pass the credentials to the Business Logic Layer
Business Logic Layer - validate the credentials (using either LDAP/ custom authentications from DB). After validation, you may decide to store the output to a session, which will be shared among all the pages.
Data Access Layer - use it to pull the respective credentials from DB (if you use your custom
i-balaji-mani 27-Jun-11 9:58am    
added simple conceptual code.
bankar mangesh 12-Oct-12 7:20am    
nice article !!!
Can u send me email verification/Confirmation without create wizard in 3Tier?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900