我正在尝试通过该程序创建一个文件夹,以保存稍后将生成的pdf。我正在使用相同的代码在本地和内部服务器中这样做:
if (!Directory.Exists(pathName))
Directory.CreateDirectory(pathName);
如果转到本地,效果很好,但是当我将其发送到内部路径时,
Directory.CreateDirectory(pathNameInternal);
创建一个文件,而不是一个实际的文件夹,这会在稍后尝试访问该命名文件夹时在代码中导致错误。
我不知道为什么要创建文件,任何人都有想法吗?
注释中的代码
theOut = @"C:\inetpub\wwwroot\UserDownloads";
Directory.CreateDirectory(theOut + "\\" + DBName);
if (copyInternal == true)
{
theOutInternal = @"\\192.168.2.40\c$\inetpub\wwwroot\UserDownloads";
Directory.CreateDirectory(theOutInternal);
Directory.CreateDirectory(theOutInternal + "\\" + DBName);
}