Пример #1
0
        public static string GetSecureStoreFieldValue(string secureStoreAppId, string fieldName)
        {
            try
            {
                Dictionary <string, string> dic = GetCredentialsFromSecureApp(secureStoreAppId);

                if (dic.ContainsKey(fieldName))
                {
                    return(dic[fieldName].ToString());
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception ex)
            {
                ULSLoggingService.LogError("Failed to retrieve the credentials from the secure store:" + ex.ToString());
                return(null);
            }
        }
Пример #2
0
        public static string GetSQLonnectionString(string secureStoreAppId)
        {
            string connectionString = "";

            try
            {
                Dictionary <string, string> dic = SecureStoreAccess.GetCredentialsFromSecureApp(secureStoreAppId);
                ULSLoggingService.LogMessage(string.Format("secure store app ID {0}  number of items {1}", secureStoreAppId, dic.Count.ToString()));

                foreach (var item in dic)
                {
                    if (item.Key.Equals("ConnectionString"))
                    {
                        connectionString = item.Value.ToString();
                    }
                }
            }

            catch (Exception ex)
            {
                ULSLoggingService.LogError("Inside GetOdbcConnectionString(): Failed to retrieve the fields from the secure store:" + ex.ToString());
            }
            return(connectionString);
        }