0

I have ASP.NET server app which has in web.config :

<appSettings file="config\another.config">

so the settings are different for each dev and stored separately in svn. is there a way to get the file name programmatically (I dont want to parse the web.config raw text just for that) ?

Boppity Bop
  • 9,613
  • 13
  • 72
  • 151

1 Answers1

1

This should do the trick:

Configuration config = WebConfigurationManager.OpenWebConfiguration("~");
AppSettingsSection appSettingSection = (AppSettingsSection)config.GetSection("appSettings");
String externalFilename = appSettingSection.File;

You will need to reference System.Web.Configuration for this.

Steve Kennaird
  • 1,604
  • 13
  • 21