How can i get the password of oracle user instance from oracle connection string using C#? -
i want user id , password of oracle db instance connection string have stored in app.config file. here connection string stored in app.config file
<add name="myconnection" connectionstring="data source=xe;user id=usmandba;password=root;" providername="system.data.sqlclient" />
i have tried oracleconnectionstring builder not return password of connection string here code:
public string conpass() { oracleconnectionstringbuilder builder = new oracleconnectionstringbuilder(); builder.connectionstring = con.connectionstring; return builder.password; }
this method return user id not password there missing? or there other way this? kindly me sort out..
connectionstring property never contains password. security measure. in code, password has been lost in line:
builder.connectionstring = con.connectionstring;
you have devise different approach. example, read connection string config , feed connection string builder. might not applicable if have connection , no information config entry constructed...
on related note, sql server connection (sqlconnection) exposes credential property used read password (i haven't tried this). don't know of similar property in oracle connection implementation.
Comments
Post a Comment