上传文件

时间:2016-04-27 12:52:30

标签: c# asp.net

您好我一直收到以下错误消息。请耐心等待我,因为我是一位不知所措的新手

http://imgur.com/j5twkP

尝试将我网站上的文件上传到数据库(由myLittleAdmin托管)后,会发生这种情况。我已经尝试向所有人,网络服务和所有其他常用的授予我的Appdata文件夹的访问权限,但我似乎仍然收到此消息。我正在运行visual studio 2013。

如果需要,

可以发布更多代码

谢谢!

访问路径' C:\ inetpub \ websites \ LocalUser \ jheslip02 \ elmtree \ img \ 2858'被拒绝。

描述:在执行当前Web请求期间发生了未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。

异常详细信息:System.UnauthorizedAccessException:访问路径' C:\ inetpub \ websites \ LocalUser \ jheslip02 \ elmtree \ img \ 2858'被拒绝。

ASP.NET无权访问所请求的资源。考虑将资源的访问权限授予ASP.NET请求标识。 ASP.NET具有基本进程标识(IIS 5上通常为{MACHINE} \ ASPNET,IIS 6和IIS 7上为网络服务,IIS 7.5上已配置的应用程序池标识),如果应用程序未模拟,则使用该标识。如果应用程序模拟通过,则标识将是匿名用户(通常为IUSR_MACHINENAME)或经过身份验证的请求用户。

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

来源错误:

第47行:{ 第48行://然后将其保存到文件夹中 第49行:FileUpload1.SaveAs(Server.MapPath(imgPath)); 第50行:
第51行:

堆栈跟踪:

[UnauthorizedAccessException:访问路径' C:\ inetpub \ websites \ LocalUser \ jheslip02 \ elmtree \ img \ 2858'被拒绝。]    System.IO .__ Error.WinIOError(Int32 errorCode,String maybeFullPath)+216    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,Boolean useLongPath,Boolean checkHost)+1430    System.IO.FileStream..ctor(String path,FileMode mode,FileAccess access,FileShare share,Int32 bufferSize,FileOptions options,String msgPath,Boolean bFromProxy)+205    System.IO.FileStream..ctor(String path,FileMode mode)+91    System.Web.HttpPostedFile.SaveAs(String filename)+160    Selling.uploadbutton_Click(Object sender,EventArgs e)位于c:\ inetpub \ websites \ LocalUser \ jheslip02 \ elmtree \ Selling.aspx.cs:49    System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)+155    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,Boolean includeStagesAfterAsyncPoint)+3804

0 个答案:

没有答案
相关问题