我制作了一个 Web 应用程序并使用File Upload server control
. 当我将文件保存到特定文件夹时,我会Access denied
一直访问此路径,同时我也会Full control
授予Every One
. 我在dev mode
. 我想要一个适用于dev mode
生产环境和生产环境的解决方案。
异常出现在以下行中:
fu.SaveAs(Server.MapPath("~//xml"));
堆栈跟踪:
StackTrace " at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)\r\n
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize , FileOptions 选项, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)\r\n at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy )\r\n 在 System.IO.FileStream..ctor(字符串路径,FileMode 模式)\r\n 在 System.Web.HttpPostedFile.SaveAs(字符串文件名)\r\n 在 System.Web.UI.WebControls。 FileUpload.SaveAs(String filename)\r\n at Schedule.ScheduleForm.btn_Search_Click(Object sender, ImageClickEventArgs e)
方法是SaveAs()
问题的原因,还是路径中有问题?因为什么都试过了,所以给很多用户完全控制权限,但是没用。