0
我有具有在web.config中ASP.NET服务器应用程式:如何获取外部appSettings文件名?
<appSettings file="config\another.config">
这样的设置对于每个dev的不同和在SVN分开储存。有没有办法以编程方式获得文件名(我不想解析web.config原始文本)?
我有具有在web.config中ASP.NET服务器应用程式:如何获取外部appSettings文件名?
<appSettings file="config\another.config">
这样的设置对于每个dev的不同和在SVN分开储存。有没有办法以编程方式获得文件名(我不想解析web.config原始文本)?
这应该做的伎俩:
Configuration config = WebConfigurationManager.OpenWebConfiguration("~");
AppSettingsSection appSettingSection = (AppSettingsSection)config.GetSection("appSettings");
String externalFilename = appSettingSection.File;
您将需要参考System.Web.Configuration这一点。
这是你想要的吗? http://stackoverflow.com/questions/6341906/read-custom-configuration-file-in-c-sharp-framework-4-0 –
没有。他知道他的文件名。我正试图找出它。 –