Search code examples
c#asp.netvisual-studio-2010web-configapp-themes

Change app_themes dynamically


I want to give my admin user the ability to change the app_themes value in the web.config dynamically, using a asp:dropbox. I have seen websites and samples in the web that allows the user to change the theme at run-time. These samples doesn't update the web.config theme value and I want my admin (office boss) to be in control of this.

Is there a way to:

  1. Get all folder names to display them in a dropbox?
  2. Update the web.config app_themes value with the selected value in the dropbox?

Solution

  • I believe this should allow you to edit the web config file

    Change a web.config programmatically with C# (.NET)

    And to get a list of all folder names in a directory to put in a dropbox:

    http://msdn.microsoft.com/en-gb/library/system.io.directory.getdirectories%28v=vs.71%29.aspx

    Hope this is what you are looking for.