How do I dynamically set the connection string?

Expand / Collapse
 

How do I dynamically set the connection string?


To dynamically set the connection string for each login, call the PostLogin() method from your login page and create methods which return the username and the database connection string depending upon the particular user.

public override void PostLogin()
{
// Call Izenda.AdHoc.AdHocSettngs.AdHocConfig.PostLogin() from your login page after authentication is successful
            
AdHocSettings.CurrentUserName = GetUserName();  
AdHocSettings.SqlServerConnectionString = GetConnectionStringByUser(AdHocSettings.CurrentUserName); 
}

Please see the security section for more details.



Details
Type: FAQ
Options