[C#] ConnectionString Password 증발현상
API 서비스 를 위해 구현중인데
초기에는 잘 연결되던 DB접속정보중 ConnectionString에 설정한 Password가 사라지는 현상이 발생했다.
그래서 DB내 SP 호출하는데 DB연결이 안되니 에러를 뱉는것이었다.
그래서 찾아보니
https://stackoverflow.com/questions/12467335/connectionstring-loses-password-after-connection-open
ConnectionString loses password after connection.Open
i'm using ADO.NET to get some information from the database on a server, so this is what i do: string conStr = "Data Source=myServer\SQLEXPRESS;Initial Catalog=DBName;User ID=myUser;Password=myPas...
stackoverflow.com
당연히 오버플로에 있었고,
SqlConnection.ConnectionString Property (System.Data.SqlClient)
Gets or sets the string used to open a SQL Server database.
docs.microsoft.com
해당 내용에 대한 MSDN,
즉, ConnectionString에 포함되는 키들 중에
Persist Security Info=true;
이걸 넣어야 된다는 것이었다. 즉, 생략하면 기본적으로 false이고, 이는 나중에 Password를 지운다라는 것이었으므로 시간이 지나 API를 다시 호출해보면 Password만 사라지는 현상이 있었던 것이다.
보안관련 이슈는 있을 수 있으니 관련 포스트들을 확인해야한다.
ps. MSDN을 다시한번 확인해보기