Link to home
Start Free TrialLog in
Avatar of Andy Green
Andy GreenFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Programatically edit Web.config

In my app we allow users to create different instances, each instance has to have access to the profile system.

How do I go about adding  sections (into the profile section) programmatically when a new instance is created.

Andy
Avatar of Dale Burrell
Dale Burrell
Flag of New Zealand image

What do you mean by an instance? I assume you can't use the regular profile management classes.

Keep in mind that if you edit web.config on the fly the app restarts which can be annoying to users. Its not the ideal place to store information which the user can change.
Avatar of Andy Green

ASKER

I mean they can set up an instance to run in a particular location, In each location the users will have their own profiles.

this is my current profile section, I want to copy a group with a new id.

        <!--When a new site group is added, create a new SiteGroupPreferences_n where n is the Sitegroup_ID from the database-->
        <group name="SiteGroupPreferences_1">
          <add name="Location_ID" type="System.int32" />
          <add name="Location" type="System.string" />
          <add name="Status" type="System.string" />
          <add name="TimeOffset" type="System.int32" />
          <add name="Session" type="System.string" />
          <add name="Activity" type="System.int32" />
        </group>
        <group name="SiteGroupPreferences_2">
          <add name="Location_ID" type="System.int32" />
          <add name="Location" type="System.string" />
          <add name="Status" type="System.string" />
          <add name="TimeOffset" type="System.int32" />
          <add name="Session" type="System.string" />
          <add name="Activity" type="System.int32" />
        </group>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of guru_sami
guru_sami
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks I will take a look. This is the standard out of the box ASP.Net profiles API. Don't really want to write a new one if we can help it.

Andy