我可以使文件夹在中等信任状态下可写吗?

发布于 2024-07-08 15:16:03 字数 282 浏览 8 评论 0原文

我的网络应用程序写入多个文件夹(日志、上传等),并且我始终通过托管提供商手动设置这些权限。

我想创建一个安装脚本来在新安装上执行此操作。 在中等信任度下这可能吗?

我连File.GetAccessControl都调用不了,更不用说File.SetAccessControl了,但反正我也不需要这么个“大锤子”。 我只想通过管理控制台执行 ISP(在本例中为 GoDaddy)允许我执行的操作。

我相信 PHP 能够做到这一点,如果可能的话,我愿意考虑使用 PHP 页面来实现此目的。

My web app writes to several folders (logs, uploads, etc), and I've always set these permissions manually through my hosting provider.

I'd like to create a setup script that performs this on new installations. Is this possible under Medium trust?

I can't even call File.GetAccessControl, let alone File.SetAccessControl, but I don't need such a "big hammer", anyway. I just want to do what the ISP (in this case GoDaddy) is letting me do through a management console.

I believe PHP is able to do this, and I'd be willing to consider a PHP page for this purpose if that's possible.

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

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

发布评论

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

评论(2

櫻之舞 2024-07-15 15:16:03

好吧,假设您以通常的方式使用 IIS 和 asp.net,您必须有一个 asp.net 帐户,框架可以在该帐户下代表您执行您的应用程序。

Web 应用程序在单个帐户下运行,并通过身份验证以编程方式授予用户访问权限,以执行您的“主帐户”代表他们执行的操作。

把它想象成这样......

Asp.net 加载你的应用程序(asp 帐户)
用户连接(用户帐户)
用户登录(?取决于所使用的帐户可能是Windows身份验证或表单身份验证等)

用户请求使用其帐户下呈现的网页执行某些操作...

asp.net检查用户是否有权执行操作(asp.net帐户)
如果用户可以执行此操作,asp.net 会按照请求的操作(asp.net 帐户)执行此操作,

因此...
您应该已经在该 ASP.NET 帐户中拥有相关权限来执行您需要执行的操作。

IIS 服务器本身通常在系统/网络服务帐户下运行。

所以问题真的是...
您希望如何向可能的用户授予写入服务器的权限。

查看框架中的成员资格提供程序和角色提供程序类,您应该能够继承它们并创建 ActiveDirectoryRoleProvider 和 ActiveDirectoryMembershipProvider 类,它们将根据 AD 中用户的角色成员身份进行身份验证,或者如果您更喜欢仅使用以下方式对数据库进行身份验证基本的 ASP.NET 提供程序类。

希望这可以帮助。

Ok assuming you are using IIS and asp.net in the usual fashion you must have an asp.net account under which the framework executes your application on your behalf.

The web application runs under a single account and through authentication users are programmatically granted access to do things that your "master account" carries out on their behalf.

Think of it as looking something like this ....

Asp.net loads your app (asp account)
User connects (iuser account)
User logs in (? depending on account used could be windows auth or forms auth, ect)

User requests to do something using your rendered web pages under their accounts ...

asp.net checks user has permission to perform operation (asp.net acount)
if user can do this asp.net acts on requested action (asp.net account)

Therefore ...
You should already have the relevant permissions in that asp.net account to do what you need to do.

There is a level above all that too ... the IIS server itself runs under the system / network service account normally.

So the question is really ...
How do you want to grant the permissions to a possible user to write to the server.

Have a look at the membership provider and roleprovider classes in the framework you should be able to inherit those and create an ActiveDirectoryRoleProvider and ActiveDirectoryMembershipProvider class that would authenticate based on role membership of users in AD, or if you prefer just authenticate against a DB with the basic asp.net provider classes.

Hope this helps.

夏至、离别 2024-07-15 15:16:03

您需要编辑配置文件
%windir%\Microsoft.NET\Framework{版本}\

请参阅 http:// msdn.microsoft.com/en-us/library/ms998341.aspx

You need to edit a config file in
%windir%\Microsoft.NET\Framework{Version}\

see http://msdn.microsoft.com/en-us/library/ms998341.aspx

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