昨天对服务器进行了更新,更新前还没有问题,更新后出错,点击上传文件后,出如下错误
Server Error in '/ducha' Application. 
Access to the path "D:\webSite\subject0006\upLoad\200512139345312.doc" is denied. 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.UnauthorizedAccessException: Access to the path "D:\webSite\subject0006\upLoad\200512139345312.doc" is denied. ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user. To grant ASP.NET write access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 
Stack Trace: [UnauthorizedAccessException: Access to the path "D:\webSite\subject0006\upLoad\200512139345312.doc" is denied.]
   System.IO.__Error.WinIOError(Int32 errorCode, String str) +393
   System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync, String msgPath, Boolean bFromProxy) +888
   System.IO.FileStream..ctor(String path, FileMode mode) +52
   System.Web.HttpPostedFile.SaveAs(String filename) +48
   Web.busines.BSCommon.UpLoadFile(HtmlInputFile upfile, String path, String& address, String& name)
   Web.webZD2.btnUp_Click(Object sender, EventArgs e)
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
   System.Web.UI.Page.ProcessRequestMain() +1277Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573 我在web.config文件里,已经设置了对文件的访问控制权
<identity impersonate="false" userName="" password=""/>
以前一直是这样写的,没有出错,更新程序后出错了,不知这是为何

解决方案 »

  1.   

    把上传目录的安全属性改为everyone完全控制就可以了.
      

  2.   

    在你要存取的目录上点击右键,选择属性,为ASPNET用户赋予读写权限
      

  3.   

    给asp.net用户一个写的权限,具体做法参考楼上两位。
      

  4.   

    asp.net權限問題,可以在打包的時候自動修改目錄權限,也可以聯系空間提供商忙修改權限,如果aspnet用戶不存在可以自行添加 注意用戶名是aspnet 不是 asp.net
      

  5.   

    這種問題在win2003 和 xp sp2 中經常有人問
      

  6.   

    是大写的APSNET,若还不行添加一个IUSE_MUNICHNAME的用户,权限都是完全控制