File.copy(strpath,DestinationPath)中拒绝对路径的访问

编程入门 行业动态 更新时间:2024-10-18 08:31:30
本文介绍了File.copy(strpath,DestinationPath)中拒绝对路径的访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

朋友, 在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服务器通常不需要访问文件系统之外的任何部分.出于安全原因,服务器在沙盒环境中执行您的代码. 检查服务是否有权访问此特定目录.
—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

更多推荐

File.copy(strpath,DestinationPath)中拒绝对路径的访问

本文发布于:2023-11-15 23:34:06,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1598951.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:路径   copy   File   DestinationPath   strpath

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!