views:

30

answers:

2

I have a ClickOnce application that will be used by two clients (multiple users each). Application connects to MSSQL/MySQL. How can I supply them different connectionString with one ClickOnce deployment?

I'd really like to keep things (as much as possible) simple on my end (and have single publish point), but how can I give them different settings?

One idea is not to give them connectionString at all, and enable application to choose server, db and username/password, then save it into userSettings.

Another idea (that I'm not very fond of) is to intercept on IIS http request for app.exe.config.deploy file and rewrite it with appropriate settings for each client.

Can this be done, err, humanely?

A: 

Since you are 'web service' based anyway, I would propose the following:

  • give each user group (each client) an unique PIN in lenghth of 4 numbers of alphanumerics
  • create lookup table at server side for PIN -> parameter translation
  • upon first app startup, ask for PIN and fetch appropriate parameters, store them locally
Daniel Mošmondor
A: 

For starters, everyone using ClickOnce should follow RobinDotNet's blog - http://robindotnet.wordpress.com

There I found link to How to: Retrieve Query String Information in a ClickOnce Application on MSDN.

Each of my clients will install app via link to .application that will contain their identifier (probably GUID). On first launch, I'll save that identifier to settings. I'll create a web service that will keep settings for all clients and track them via their identifier.

Vnuk
I'm glad you found that helpful; that's the direction I was going with the comment above. And thanks for the shoutout!
RobinDotNet