+ Start a Discussion
Sam MalhotraSam Malhotra 

Authentication Login

public class Sharepoint2{
public String ConfigurationManager{get;set;}

public boolean Login(string email, string password)
     {
   
      boolean validateLogin = false;
      List<string> MessageList = new List<string>();
      
  
      if (email == ConfigurationManager.AppSettings ['Email'] 
          && password == ConfigurationManager.AppSettings ['Password'])
      {
     string authInfo = email + ':' + password;
     authInfo = Convert.ToBase64String(System.Text.Encoding.Default.GetBytes(authInfo));
  
     System.Web.HttpContext.Current.Response.AppendHeader('Authorization', 'Basic' + authInfo);
 
     MessageList.Add('Login Successful');
     validateLogin = true;
      }
      else
      {
     MessageList.Add('Invalid Username Or Password');
      }
      return validateLogin;
     }
     }


Error: Variable does not exist: AppSettings at line 11 column 41

Thanks In Advance!!
Regards Sam!!!
Raj VakatiRaj Vakati
Hi Sam , 

Your data type ConfigurationManager is String. So you are not able to referee AppSettings from the String. Modify the code as shown below  
public class Sharepoint2{
public ConfigurationManager confManagere{get;set;}

public boolean Login(string email, string password)
     {
   
      boolean validateLogin = false;
      List<string> MessageList = new List<string>();
      
  
      if (email == confManagere.AppSettings ['Email'] 
          && password == confManagere.AppSettings ['Password'])
      {
     string authInfo = email + ':' + password;
     authInfo = Convert.ToBase64String(System.Text.Encoding.Default.GetBytes(authInfo));
  
     System.Web.HttpContext.Current.Response.AppendHeader('Authorization', 'Basic' + authInfo);
 
     MessageList.Add('Login Successful');
     validateLogin = true;
      }
      else
      {
     MessageList.Add('Invalid Username Or Password');
      }
      return validateLogin;
     }
     }


 
Sam MalhotraSam Malhotra
Error: Compile Error: Invalid type: ConfigurationManager at line 2 column 29