将文件上载到自己的服务器时出现问题 [英] Problem while uploading file to the own server

查看:73
本文介绍了将文件上载到自己的服务器时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建一个页面,我上传图像,但它给出错误,任何人都可以帮助


异常详情:System.UnauthorizedAccessException:访问路径'D:\INETPUB \VHOSTS \apunkashaher.com \httpdocs\tree\image.jpg'被拒绝。

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

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

解决方案

错误消息是如此解释。运行应用程序的asp.net进程没有对您尝试存储文件的文件夹的写入访问权限。这是一个默认行为,并且出于明显的安全原因而实现。

这应该可以帮助你 - http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.fileupload.aspx#security_considerations [ ^ ]

 i make a page from which i upload image but it gives error , can anybody help 


Exception Details: System.UnauthorizedAccessException: Access to the path 'D:\INETPUB\VHOSTS\apunkashaher.com\httpdocs\tree\image.jpg' 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 and IIS 7, and the configured application pool identity on IIS 7.5) 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 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.

解决方案

The error message is so explanatory. The asp.net process under which you application is running do not have ''write'' access to the folder where you are trying to store the file. The is a default behaviour and implemented for obvious security reasons.
This should help you - http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.fileupload.aspx#security_considerations[^]


这篇关于将文件上载到自己的服务器时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆