我无法使用 FileUpload.SaveAs() 或 File.WriteAllText() 在我的网络服务器上保存文件。我保存的文件夹是 CHMOD 666。
我的代码是这样的:
File.WriteAllText(MapPath(".") + "\\Ads\\test.jpg", "test");
此代码在 Dev 中完美运行。服务器。
最好的问候, Lasse Espeholt
System.UnauthorizedAccessException:对路径 *' 的访问被拒绝。在 System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) 在 System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs , String msgPath, Boolean bFromProxy) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy) at System.IO.FileStream..ctor (String path, FileMode mode) at System.Web.HttpPostedFile.SaveAs(String filename) at System.Web.UI.WebControls.FileUpload.SaveAs(String filename) at *(Object sender, ListViewInsertEventArgs e)