【发布时间】:2014-02-04 20:42:10
【问题描述】:
看一个例子,服务器在streamReader上从客户端接收文件。
string key = "UploadSalesFileToServer";
GetValue(key);
被添加到函数中,它使用:
private static string GetValue(string name)
{
var fileMap = new ExeConfigurationFileMap();
fileMap.ExeConfigFilename = System.Web.HttpContext.Current.Server.MapPath("~/Modules/Work/web.config");
var configuration = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None);
string configValue = configuration.AppSettings.Settings[name].Value;
return configValue;
}
在 web.config 中我使用:
<appSettings>
<add key="UploadSalesFileToServer"
value="1111-fasad-32233-ffdsff"/>
</appSettings>
谁能告诉我这里到底发生了什么?应用设置用于检查是否接收到正确的文件?
【问题讨论】:
-
我不确定你在问什么。一切正常吗?您不确定它为什么/如何工作?
-
我不确定它的用途是什么?但它不会抛出任何错误?
标签: c# asp.net asp.net-mvc asp.net-mvc-3 appsettings