我正在尝试在共享位置服务器上上传文档(应用程序在一台服务器上,文档上载文件夹在其他服务器上)。在保存的同时我得到了" SaveAs方法被配置为需要一个有根路径,并且路径是''没有根源" 错误。
var folderPath = string.Empty;
var fileFullName = string.Empty;
var fullFilePath = string.Empty;
var dir = ConfigurationManager.AppSettings["DocPath"];
folderPath = Path.Combine(dir, "Sample");
fileFullName = attachmentEntites.Id + "_" + attachmentEntites.AttachmentId + attachmentEntites.FileExtn;
fullFilePath = Path.Combine(folderPath, fileFullName.ToString());
if (File.Exists(fullFilePath))
{
File.Delete(fullFilePath);
}
fuFile.PostedFile.SaveAs(fullFilePath);
<add key="DocPath" value="\\Server2\UpDoc\" />