本文介绍了File.copy(strpath,DestinationPath)中拒绝对路径的访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
—SA
Check if this path is withing the root directory of the site. HTTP server normally does not require to access any part of file system beyond that. The server executes your code in a sandboxed environment, for security reasons.
Check if the service has access to this particular directory.
—SA
朋友, 在Asp中,将文件从一台服务器复制到另一台服务器,然后预占错误,例如 File.copy(strpath,DestinationPath)中拒绝访问该路径 该进程位置路径发生了常见的网络路径,即使出现错误,但是相同的代码开发环境也可以正常工作. 如何解决这个问题. 请让我知道代码. Adevance的愿望!!! Ramesh M.
hi Friends, In Asp copy the file one server to another then camp up error like Access to the path is Denied in File.copy(strpath,DestinationPath) this process location path happend common network path, even though got error , but same code development environment is working fine. how to over come this issue. pls let me know with code. Adevance Wishes!!!! Ramesh M.
推荐答案从您给出的消息中,可能有两种可能性. 1)检查您要复制的文件是否被您或其他人使用/锁定. 2)检查目标文件夹是否具有粘贴文件的相应权限.尽管它可以在您的开发环境上运行,但是您应该检查正在运行此代码的用户是否具有相应的特权. From what message you gave, there could be couple of possibilities. 1) Check if the file which you are trying to copy is either used/locked by you or some other person. 2) Check if the destination folder has respective previlige for pasting the file. Though it works on your development environment, You should check if the user who is running this code has respective previlige .
已尝试调试并查找错误是否是由于读取错误而导致的.源或粘贴错误到目标. 如果是源错误,则必须确保已将IUSR_MachineName用户帐户添加到该文件夹中 如果是目的地,则必须在目标文件夹上进行验证. 如果IIS不在IUSR_上下文下运行,则必须检查它正在其下运行的用户上下文,并提供对文件夹中用户的访问权限. Have tried to debug and find if the error is due to a read error from the source or paste error to the destination. If it is the source error you have to make sure that you''ve added IUSR_MachineName user account to that folder If it destination you have to verify the same on the target folder. If the IIS is not running under IUSR_ context then you have to check the user context it is running under and provide access to the user on the folders.
检查该路径是否与根目录不符网站的目录. HTTP服务器通常不需要访问文件系统之外的任何部分.出于安全原因,服务器在沙盒环境中执行您的代码. 检查服务是否有权访问此特定目录.
更多推荐
File.copy(strpath,DestinationPath)中拒绝对路径的访问
发布评论