如何使用c#代码从web.config访问文件夹路径.这是一个示例代码.
如何在Web配置中放置此路径 C:\\whatever\\Data\\sample.xml
我必须从web配置中读取此路径.
string folderpath = ConfigurationSettings.AppSettings["path"].ToString();
using (XmlWriter xw = XmlWriter.Create(folderpath, new XmlWriterSettings { Indent = false }))
Run Code Online (Sandbox Code Playgroud)
请帮忙.....
以下是一些可以帮助您的示例代码
这进入你的web.config.
<configuration>
<appSettings>
<add key="myFilePath" value="C:\\whatever\\Data\\sample.xml"/>
</appSettings>
</configuration>
Run Code Online (Sandbox Code Playgroud)
这就是你读它的方式:
path = System.Web.Configuration.WebConfigurationManager.AppSettings["myFilePath"].ToString();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
22728 次 |
| 最近记录: |