We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

hmld
Posts: 11
Joined: Mon May 20, 2013 1:55 pm

Modify connection string depending on user's choice

Hello,

I know how to add custom values to connection string in web.config using properties. But what if I have to modify connection string depending on user's choice? I mean a scenario like the following:
During installation, user can select type of sql authentication: will it be sql server authentication or windows authentication. So, in the case of sql authentication type, connection string will be like the following: <add name="myname" connectionString="Data Source=.;Initial Catalog=mydatabase;user id=myuser;password=mypass;Async=true"/>. In the case of windows authentication, connection string should be like the following: <add name="myname" connectionString="Data Source=.;Initial Catalog=mydatabase;Integrated Security=SSPI;Async=true"/>.

I am able to modify connection string using custom properties, i.e.: Data Source=.;Initial Catalog=[DB_NAME_PROP]

So, the question is: how can I transform first connection string into another, if user selects windows authentication? How can I delete user id and password from connection string and add Integrated Security=SSPI depending on a property?

Thank you very much.
hmld
Posts: 11
Joined: Mon May 20, 2013 1:55 pm

Re: Modify connection string depending on user's choice

Already done by using public properties, thanks

Return to “Common Problems”