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) ?

2
  • Is this what you want ? stackoverflow.com/questions/6341906/… Commented Oct 16, 2012 at 10:38
  • no. he knows his filename. i am trying to find it out. Commented Oct 16, 2012 at 10:45

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.