Allowing users to change dataportal to application server mode

Allowing users to change dataportal to application server mode

Old forum URL: forums.lhotka.net/forums/t/4977.aspx


Marjon1 posted on Monday, June 16, 2008

We are writing an application were the user can choose to use an application server or not. This information is stored within the app.config of the project. However, we are in the process of getting the application certified for use with Windows Vista (to get some Microsoft Partner Points) and the app.config file can not be changed by a normal user (only admin) which is presenting a problem for us.

We can move the database connection and number of other settings that can change out into their own settings.config file stored within a writable path on the system, however, if we move the csla settings then we would need to change CSLA itself. This we want to avoid if at all possible.

I was curious if anyone else has ran into this problem and how they have solved it, or what approach you would take. The other alternative is to write a seperate application which can escalate permsissions, but this would be a bit of a pain with our current setup.

Thanks,

Marjon

sergeyb replied on Monday, June 16, 2008

I think (not 100% sure though) that you can write settings using ConfigurationManager without actually having to commit any changes to hard-drive / app.config.  So, you can store settings in separate cofig file, then use ConfigurationManager to create an in-memory setting that CSLA can read.

 

Sergey Barskiy

Senior Consultant

office: 678.405.0687 | mobile: 404.388.1899

cid:_2_0648EA840648E85C001BBCB886257279
Microsoft Worldwide Partner of the Year | Custom Development Solutions, Technical Innovation

 

From: Marjon [mailto:cslanet@lhotka.net]
Sent: Monday, June 16, 2008 2:02 AM
To: Sergey Barskiy
Subject: [CSLA .NET] Allowing users to change dataportalto application server mode

 

We are writing an application were the user can choose to use an application server or not. This information is stored within the app.config of the project. However, we are in the process of getting the application certified for use with Windows Vista (to get some Microsoft Partner Points) and the app.config file can not be changed by a normal user (only admin) which is presenting a problem for us.

We can move the database connection and number of other settings that can change out into their own settings.config file stored within a writable path on the system, however, if we move the csla settings then we would need to change CSLA itself. This we want to avoid if at all possible.

I was curious if anyone else has ran into this problem and how they have solved it, or what approach you would take. The other alternative is to write a seperate application which can escalate permsissions, but this would be a bit of a pain with our current setup.

Thanks,

Marjon


JoeFallon1 replied on Monday, June 16, 2008

How about using this technique:

In the app.config file set:

<appSettings file="user.config">

Then in the file user.config you can set:

<?xml version="1.0" encoding="utf-8" ?>
   <appSettings> 
       <add key="ConnectionString" value="data source=myDBServer;database=MyDB;uid=someUser;password=somePwd" />
   </appSettings>

Joe

 

Marjon1 replied on Monday, June 16, 2008

The problem with this method is that the user.config file must be a relative path to the app.config, which means that it is going to have the same file access issues. If it was possible to do something like

<appSettings file="%appdata%\user.config">

It could then put the data in the application data folder this would work fine.
I've tested this and it doesn't work :(

Any other suggestions?

Copyright (c) Marimer LLC