尝试在服务器上创建文件夹时访问被拒绝

发布于 2024-11-18 01:10:12 字数 769 浏览 10 评论 0原文

客户端注册系统的每个新项目都会创建一个文件夹来存储位于“\Images\Projects{ProjectID}”中的图像,其中{ProjectID}是项目ID。

我在文件夹“\Images\Projects\”中放入了一个 web.config 以允许登录用户访问。

<configuration>
    <system.web>
        <authorization>
            <deny users="?" />
        </authorization>
    </system.web>
</configuration>

创建文件夹时出现错误:

访问路径 'e:\home\amsdarquit\Web\Images\Projects\166' 被拒绝。

166是项目代码和文件夹名称。 我检查了我的服务器,但没有创建相同的内容。

创建文件夹的代码

//Save Image
var serverPath = Server.MapPath(Href("~/Images/Projects/") + id);
Directory.CreateDirectory(serverPath);
imgOri.Save(Path.Combine(serverPath, fileName));

我在网站上查看过,但没有找到任何帮助我的东西。

Every new project that the client registers the system creates a folder to store the images located in "\Images\Projects{ProjectID}" where {ProjectID} is the ID project.

I put in the folder "\Images\Projects\" a web.config to allow access to users logged on.

<configuration>
    <system.web>
        <authorization>
            <deny users="?" />
        </authorization>
    </system.web>
</configuration>

When creating the folder, the error is displayed:

Access to the path
'e:\home\amsdarquit\Web\Images\Projects\166'
is denied.

166 is the project code, and the folder name.
I checked on my server, and the same is not created.

Code to create the folder

//Save Image
var serverPath = Server.MapPath(Href("~/Images/Projects/") + id);
Directory.CreateDirectory(serverPath);
imgOri.Save(Path.Combine(serverPath, fileName));

I have looked on the site, but found nothing to help me.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

爱的那么颓废 2024-11-25 01:10:12

检查“NETWORK SERVICE”用户(或运行应用程序的用户)是否具有驱动器上父目录的修改权限。

Check whether 'NETWORK SERVICE' user (or the user that you run your application as) has modification rights for the parent directory on the drive.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文