web.config和权限 [英] web.config and permission

查看:109
本文介绍了web.config和权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有Framework 3.5,Windows 7 Premium版.
使用VS 2008,C#.

我想在我的网站(现在已经在我自己的计算机上测试过)中使用OpenFileDialog.
也使用文件.

当我刚刚将文件名分配给OpenFileDialog的类时,我遇到了一个异常:
请求类型为``system.security.permissions.fileiopermission,mscorlib,版本= 2.0.0.0,文化=中性,PublicTokenKey = b77a5c561934e089''的许可失败.

我看到了一些解决方案,这导致我在我的方法顶部插入:
[System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand,名称="FullTrust")]

(我不知道按照我的方法进行操作是否还可以:
[System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Assert,Unrestricted = true)])

同样在assemblyinfo.cs上:
[程序集:FileIOPermission(SecurityAction.RequestMinimum,Unrestricted = false,Write ="c:\\ MyFolder"

但是上面的内容使我可以访问网页,但是什么也看不到
(我认为有一个例外,但不知道如何检查).

我想知道是否可以在web.config中配置某些内容,
并放置我自己的权限集(我不知道权限集对象是否能给我答案).
我还需要一个完整的web.cofig教程.

谢谢:)

I have Framework 3.5, Windows 7 Premium edition.
Use VS 2008, C#.

I want to use a OpenFileDialog in my web site (now tested on my own computer).
Also using files.

When I had just assigning filename to the class of OpenFileDialog, I have got an exception :
request for the permission of type ''system.security.permissions.fileiopermission,mscorlib, version = 2.0.0.0, Culture = neutral,PublicTokenKey=b77a5c561934e089'' failed.

I see some solution, that lead me to insert on top of my method :
[System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name = "FullTrust")]

(I don''t know whether following on top of my method is also ok :
[System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Assert, Unrestricted = true)])

Also on assemblyinfo.cs :
[assembly: FileIOPermission(SecurityAction.RequestMinimum, Unrestricted = false, Write = "c:\\MyFolder"

But the above make me access the web-page, but I can see nothing
(I think there is an exception, but don''t know how to check that).

I want to know, whether I can configure something in web.config,
and put there my own permission-set (I don''t know whether permission-set object give me an answer).
I need also a full tutorial for web.cofig.

Thanks :)

推荐答案

尝试以下帖子 [ ^ ]具有答案
Try this post[^] which has answer


这篇关于web.config和权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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