I have a code in my program that appends characters to a SecureString (secureConnStr) variable in a foreach loop of connectionString.ToCharArray(). For simplicity sake:
private static SecureString _connStr = null; public static SecureString ConnStr{ get{ string cStr = "Server=XXXX;Initial Catalog=XXXX"; foreach(var c in cStr.ToCharArray()){ _connStr.AppendChar(c); } return _connStr; } } To retrieve the connection string, I carried out the following:
public string GetConnString(secureConnStr){ IntPtr str = Marshal.SecureStringToBSTR(secureConnStr) return str; } I am using the above method to retrieve the connection string and to open an SQL connection. We tested this in a few environment and it was working fine but in one of the environment, we encountered the following error:
Keyword not supported: 'sterver'.: at System.Data.Common.DbConnectionOpti ...

Go to the complete details ...