404 - 找不到文件或目录。 [英] 404 - File or directory not found.

查看:105
本文介绍了404 - 找不到文件或目录。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友们,

虽然iam删除gridview中的文件(网站托管)我无法删除文件。说404 - 文件或目录未找到。但在本地我能够删除。

请求帮助我们..



Hi friends,
While iam deleteing a file in gridview (websited hosted) i cant able to delete the file.its saying 404 - File or directory not found.but in locally i can able to delete.
Pleas help me guys..

string path = Server.MapPath(PhotoPath + value3.Text);//"~/Admin/Content/Activites/Gallery/SportsGallery/images/" + value3.Text);

                       System.IO.File.Delete(path);

                       string path1 = Server.MapPath(ImagePath + value3.Text);//"~/Admin/Content/Activites/Gallery/SportsGallery/" + value3.Text);

                       System.IO.File.Delete(path1);

推荐答案

请看我对这个问题的评论,还要记住一件事:在使用的路径中'〜'作为 MapPath 的参数是为您的站点设置的根目录,而不是主机的文件系统根目录。通常,您无法访问站点根目录之外的任何文件,因为您的ASP.NET代码在沙盒环境中执行,这限制了对任何其他文件系统对象的访问,无论权限是什么。

-SA
Please see my comment to the question and also remember one more thing: '~' in the path used as an argument to MapPath is the root directory set up for your site, not your host's file system root. And normally you cannot access any files outside your site's root, as your ASP.NET code is executed in sandboxed environment which limits the access to any other file system objects, no matter what permissions are.
—SA


您的应用程序是否有权在目标文件夹上执行事务?大多数主机提供了设置文件夹权限的方法,例如读取,写入,读取/写入,读取/执行等。检查文件夹的权限并查看是否需要修改它们。虽然您的用户帐户可能使您能够执行文件管理活动,但您的应用程序可能具有相同的权限。
Does your application have permissions to perform transactions on the target folder? Most hosts provide a way to set folder permissions, such as read, write, read/write, read/execute, etc. Check the permissions for the folder and see if they need to be modified. While your user account might give you the ability to perform file management activities, your application might not the same rights.


这篇关于404 - 找不到文件或目录。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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