0

我正在尝试使用以下方法创建文件:

Dim stmFile As Stream = File.Open(filename, FileMode.OpenOrCreate, FileAccess.Write)

这应该创建一个文件,因为指定的文件当前不存在,但是它会引发服务器错误:

Could not find a part of the path 'c:\tempemail\681968_File.doc'. 

Description: An unhandled exception occurred during the execution of the current web
request. Please review the stack trace for more information about the error and where 
it originated in the code. 

Exception Details: System.IO.DirectoryNotFoundException: 
Could not find a part of the path 'c:\tempemail\681968_File.doc'.

有什么建议吗?

4

1 回答 1

1

尝试以下

  • 确保tempemail存在
  • 确保应用程序池用户对该文件夹具有写入权限。
于 2012-09-25T10:24:31.100 回答