简体   繁体   English

从web.config中的appsettings中读取文件属性

[英]Read file attribute from appsettings from web.config

In my web.config I have the following 在我的web.config中,我有以下内容

<appSettings file="C:\\Config\\myproj\\Appsettings.Config">

file attribute doesn't come under NameValueCollection, so how can I read the file attribute? 文件属性不在NameValueCollection下,那么如何读取文件属性? I want to read this attribute and then perform some operation. 我想读取此属性,然后执行一些操作。

This should give you the file path of the AppSettings file attribute: 这应该为您提供AppSettings文件属性的文件路径:

ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None)
                    .AppSettings
                    .File;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM