服务器:win2003
在网站上创建一个目录。h:\freehost\web\upload目录下创建一个年月组成的文件夹(2000509),程序代码很很简单,就是有无这个目录,无就创建。System.Web.HttpUnhandledException: 发生类型为 System.Web.HttpUnhandledException 的异常。 ---> System.IO.DirectoryNotFoundException: 未找到路径“h:\”的一部分。 at System.IO.__Error.WinIOError(Int32 errorCode, String str) at System.IO.Directory.InternalCreateDirectory(String fullPath, String path) at System.IO.Directory.CreateDirectory(String path) at WebApplication2.WebForm1.createdoor() at WebApplication2.WebForm1.Page_Load(Object sender, EventArgs e) 实际上网站上的服务器上是有h:\freehost\web\upload这个目录的。目前已经怀疑是win2003上ASP.NET的权限问题。不知道win2003中权限应该如何设置
在网站上创建一个目录。h:\freehost\web\upload目录下创建一个年月组成的文件夹(2000509),程序代码很很简单,就是有无这个目录,无就创建。System.Web.HttpUnhandledException: 发生类型为 System.Web.HttpUnhandledException 的异常。 ---> System.IO.DirectoryNotFoundException: 未找到路径“h:\”的一部分。 at System.IO.__Error.WinIOError(Int32 errorCode, String str) at System.IO.Directory.InternalCreateDirectory(String fullPath, String path) at System.IO.Directory.CreateDirectory(String path) at WebApplication2.WebForm1.createdoor() at WebApplication2.WebForm1.Page_Load(Object sender, EventArgs e) 实际上网站上的服务器上是有h:\freehost\web\upload这个目录的。目前已经怀疑是win2003上ASP.NET的权限问题。不知道win2003中权限应该如何设置
点击 添加 按钮,查找并且选择 ASPNET 用户:
然后点击 确定按钮,这时会出现一个窗口,让您选择此用户所能拥有的权限。在这里,我们将除了 "读取属性" 这个权限不拒绝以外,其它的全部拒绝(不将"读取属性"这一项拒绝是非常重要的,如果将其拒绝,则会导致ASP.NET程序在拥有权限的目录下也不能完成所有的操作(如在自己的目录下创建目录时提示: 未找到路径“X:\”的一部分 这样的错误)
这样,ASP.NET程序就只能对其所在目录进行操作,而无法涉及到其它的文件目录。如果想在D盘创建目录的话,那就在刚才的地方开启ASPNET读写权限就行了