Click here to Skip to main content
11,429,382 members (65,186 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET
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 26-Jun-11 19:38pm
Edited 27-Jun-11 0:41am
v2

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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
  Permalink  
v3
Comments
Ramalinga Koushik at 27-Jun-11 5:45am
   
Good Call. My 5 too.
Prerak Patel at 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
Balaji Mani at 27-Jun-11 9:58am
   
added simple conceptual code.
bankar mangesh at 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)



Advertise | Privacy | Mobile
Web04 | 2.8.150428.2 | Last Updated 12 Oct 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100