上传图像时访问被拒绝错误

时间:2015-04-19 10:00:07

标签: asp.net .net file-upload access-denied

在将图像上传到服务器时,我收到服务器拒绝访问的错误。是否有相同的工作。

这是堆栈跟踪以及屏幕截图enter image description here

  

' /'中的服务器错误应用。访问路径   ' G:\ PleskVhosts \ rstechnopoint.com \ fitness-first.rstechnopoint.com \ images_1EP017.jpg'   被拒绝。描述:期间发生了未处理的异常   执行当前的Web请求。请查看堆栈跟踪   有关错误及其来源的更多信息   代码。

     

异常详细信息:System.UnauthorizedAccessException:访问   路径   ' G:\ PleskVhosts \ rstechnopoint.com \ fitness-first.rstechnopoint.com \ images_1EP017.jpg'   被拒绝。

     

ASP.NET无权访问所请求的资源。考虑   授予对ASP.NET请求的资源访问权限   身份。 ASP.NET具有基本进程标识(通常是   IIS 5上的{MACHINE} \ ASPNET或IIS 6上的网络服务)如果使用的话   该申请不是冒充。如果申请是   冒充通过,身份将是   匿名用户(通常是IUSR_MACHINENAME)或经过身份验证的用户   请求用户。

     

要授予对文件的ASP.NET访问权限,请右键单击“文件”中的文件   资源管理器,选择"属性"并选择“安全”选项卡。点击"添加"   添加适当的用户或组。突出显示ASP.NET帐户,   并选中所需访问的框。

     

来源错误:

     

第113行:path =   HttpContext.Current.Server.MapPath(" /&#34);第114行:
  path + =" images /" + vUpload;第115行:
  imageupload.SaveAs(路径);第116行:第117行:
  vPicture ="〜/ images /" + imageupload.FileName.ToString();

     

源文件:   G:\ pleskvhosts \ rstechnopoint.com \ fitness-first.rstechnopoint.com \轮廓\ editprofile.aspx.cs   行:115

     

堆栈追踪:

     

[UnauthorizedAccessException:访问路径   ' G:\ PleskVhosts \ rstechnopoint.com \ fitness-first.rstechnopoint.com \ images_1EP017.jpg'   被拒绝。] System.IO .__ Error.WinIOError(Int32 errorCode,String   maybeFullPath)+7724975 System.IO.FileStream.Init(String path,   FileMode模式,FileAccess访问,Int32权限,布尔useRights,   FileShare共享,Int32 bufferSize,FileOptions选项,   SECURITY_ATTRIBUTES secAttrs,String msgPath,Boolean bFromProxy)   +1162 System.IO.FileStream..ctor(字符串路径,FileMode模式,FileAccess访问,FileShare共享,Int32 bufferSize,FileOptions   options,String msgPath,Boolean bFromProxy)+61
  System.IO.FileStream..ctor(String path,FileMode mode)+55
  System.Web.HttpPostedFile.SaveAs(String filename)+99
  System.Web.UI.WebControls.FileUpload.SaveAs(String filename)+23
  profile_editprofile.uploadbtn_Click(Object sender,EventArgs e)in   G:\ pleskvhosts \ rstechnopoint.com \ fitness-first.rstechnopoint.com \轮廓\ editprofile.aspx.cs:115   System.Web.UI.WebControls.Button.OnClick(EventArgs e)+111
  System.Web.UI.WebControls.Button.RaisePostBackEvent(字符串   eventArgument)+110
  System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(字符串   eventArgument)+10
  System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler   sourceControl,String eventArgument)+13
  System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)   +36 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,Boolean includeStagesAfterAsyncPoint)   1565

2 个答案:

答案 0 :(得分:1)

根据我的经验,Plesk面板远不如PHP cPanel先进。据我所知,它不允许您自己更改文件夹权限,您的托管公司应该有技术帮助聊天/电子邮件,您可以向他们发送消息

你去了:this是非常基本的:/

答案 1 :(得分:1)

在plesk的当前文件管理器GUI中,如果您知道要查看的位置(很容易错过),则可以轻松更改访问权限。当您将鼠标悬停在一行上时,右下方会出现一个下拉图标,如下所示。

enter image description here

为相应的帐户授予写入权限,您应该好好去。

相关问题