Join 34,000+ subscribers and receive articles from our
blog about software quality, testing, QA and security.

ConfigurationBuilder to select user folder


My App runs on server via RDP. I.e. all users run the same app from same location on server. In a multi-user environment, writing log files to a particular location will cause a clash due to file locking.
Is it possible to specifiy some keyword in the config builder so that each user’s logfile write to his AppData folder.


Hello Louis,

Thanks for your posting. You can use variables in the connection string and then set the variable value later at runtime. The relevant API method would be SetVariable in this case. Here’s an example:

// Define the variable "key" with the value "secret"
SiAuto.Si.SetVariable("key", "secret");
// And include the variable $key$ in the related connections
// string (the connections string can either be set directly
// or loaded from a file).
file(encrypt="true", key="$key$")

The idea would be to add a variable for the AppData folder and then set lookup and set the actual AppData path via SetVariable. This has the advantage that you can use a generic and reusable connection string.

I hope this helps!