简体   繁体   English

如何创建文本文件并将其保存到共享目录?

[英]How to create a Text file and save it to a shared-directory?

I'm having an issue here, I developed an application in C# which creates a text file. 我在这里遇到问题,我在C#中开发了一个创建文本文件的应用程序。 This text file is saved in the X:\\Public\\3rd\\ASN\\, the problem is that in development the files are created and saved with no issues but once I move the application into our Web Server the appplication fails and it throws out this error "Could not find a part of the path X:\\Public\\3rd\\ASN\\1175_0001.txt". 此文本文件保存在X:\\ Public \\ 3rd \\ ASN \\中,问题是在开发过程中创建并保存文件没有问题但是一旦我将应用程序移动到我们的Web服务器中,应用程序就会失败,它会抛出这个错误“找不到路径X的一部分:\\ Public \\ 3rd \\ ASN \\ 1175_0001.txt”。

This is the code I'm using to saved the file in the directory: 这是我用来保存目录中的文件的代码:

w = File.CreateText("X:\Public\Public\3rd\ASN\1175ASN_0001.txt");

Keep in mind that this directory is another server. 请记住,此目录是另一台服务器。

Any help will be really appreciate it. 任何帮助都会非常感激。

your X drive is a mapped network drive. 您的X驱动器是映射的网络驱动器。 You need to use the network url eg \\\\server\\directory\\Public\\3rd\\ASN\\1175_0001.txt 您需要使用网络URL,例如\\\\server\\directory\\Public\\3rd\\ASN\\1175_0001.txt

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

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