C#3.5 ASP.net文件IO问题,UnauthorizedAccessException和网络上的共享文件 [英] C# 3.5 ASP.net File IO issue, UnauthorizedAccessException to file on network share

查看:176
本文介绍了C#3.5 ASP.net文件IO问题,UnauthorizedAccessException和网络上的共享文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到一个UnauthorizedAccessException每次我尝试访问(只的阅读)在网络共享文件中的\\\\服务器\\文件夹1 \\文件夹2 \\ file.pdf。

I get an UnauthorizedAccessException everytime I try to access (just read) a file on a network share "\\server\folder1\folder2\file.pdf."

我冒充已阅读和放大器域\\ ASPNET用户;写访问上述文件夹中。该文件不是只读的。

I am impersonating the domain\aspnet user which has read & write access to the above mentioned folders. The file is not read-only.

我试图通过System.Security.Permissions.FileIOPermission找到的权限。它只是说noaccess下的所有文件。

I tried finding the permissions via System.Security.Permissions.FileIOPermission. It just says NoAccess to all files.

我不知道还有什么我能做的。

I'm not sure what else I can do.

我使用Visual Studio 2008,ASP.net 2.0 Framework 3.5中,WINXP,IIS 5.1。

I am using Visual Studio 2008, ASP.net 2.0 on Framework 3.5, WinXP, IIS 5.1.

推荐答案

ASP.NET用户将无法与网络路径工作。所以,你需要有一个Windows帐户
将所有的权利,那么你需要的东西imposernate在web.config中像下面。

ASP.NET user will not work with network path. So you need to have a windows account that will have all the rights and then you need to imposernate things in web.config like following.

身份冒充=真的userName =域名\\ windowuseraccount密码=密码

identity impersonate="true" userName="domainname\windowuseraccount" password="password"

这篇关于C#3.5 ASP.net文件IO问题,UnauthorizedAccessException和网络上的共享文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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