安全角色例外 [英] Security Role Exception
问题描述
我似乎(再一次)遗漏了一些非常基本的东西。
我在Windows XP Professional Service Pack 1下运行所有修补程序
已安装和调试模式下的Visual Studio .NET 2003.
以下报告您有>管理员<角色。
使用System.Security.Principal;
使用System.Security.Permissions;
[PrincipalPermissionAttribute(SecurityAction.Demand,Role =" Administrator")]
private void Exercise15_2_Load(object sender,System.EventArgs e)
{
MessageBox.Show("你有>" + WindowsBuiltInRole.Administrator +"<
角色。");
}
如果我取消注释单个语句,则会抛出安全异常...
发生类型为System.Security.SecurityException的未处理异常
mscorlib.dll中的
其他信息:请求主要许可失败。
我缺少什么?
-
- Thom Little - www.tlaNET.net - Thom Little Associates,Ltd。
-
I seem to (once again) be missing something pretty basic.
I am running under Windows XP Professional Service Pack 1 with all Hotfixes
installed and Visual Studio .NET 2003 in Debug mode.
The following reports "You have the >Administrator< role."
using System.Security.Principal ;
using System.Security.Permissions ;
[PrincipalPermissionAttribute(SecurityAction.Demand ,Role="Administrator")]
private void Exercise15_2_Load( object sender, System.EventArgs e )
{
MessageBox.Show( "You have the >" + WindowsBuiltInRole.Administrator + "<
role." );
}
If I uncomment the single statement a security exception is thrown ...
An unhandled exception of type ''System.Security.SecurityException'' occurred
in mscorlib.dll
Additional information: Request for principal permission failed.
What am I missing?
--
-- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
--
推荐答案
尝试修改你的属性。
[PrincipalPermissionAttribute(SecurityAction.Demand,Role =" BUILTIN \Administra
tor)
-
Jared Parsons [MSFT]
ja ****** @ online.microsoft.com
此帖子按原样提供。没有保证,也没有授予任何权利。
如果您希望在帖子中加入脚本样本,请添加使用
包含的脚本样本受制于
指定的条款http://www.microsoft.com/info/cpyright.htm"
Thom Little <第** @ tlanet.net>在留言中写道
news:et ************** @ TK2MSFTNGP11.phx.gbl ...
Try modifying your attribute to this.
[PrincipalPermissionAttribute(SecurityAction.Demand ,Role="BUILTIN\Administra
tor")]
--
Jared Parsons [MSFT]
ja******@online.microsoft.com
This posting is provided "AS IS" with no warranties, and confers no rights.
OR if you wish to include a script sample in your post please add "Use of
included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm"
"Thom Little" <th**@tlanet.net> wrote in message
news:et**************@TK2MSFTNGP11.phx.gbl...
我好像(曾经)再次)遗漏一些非常基本的东西。
我在Windows XP Professional Service Pack 1下运行,安装了所有
修补程序,并在调试模式下运行Visual Studio .NET 2003.
使用System.Security.Principal;
使用System.Security.Permissions;
[PrincipalPermissionAttribute(SecurityAction.Demand,Role =" Administrator" ;)
private void Exercise15_2_Load(object sender,System.EventArgs e)
{MessageBox.Show(" you have the gt;" + WindowsBuiltInRole.Administrator +
"< role。");
}
如果我取消注释单个语句,则会抛出安全异常......
类型未处理的异常''System.Security.SecurityException''
发生在mscorlib.dll
附加信息:请求主要许可失败。
我缺少什么?
-
- Thom Little - www.tlaNET.net - - Thom Little Associates,Ltd。
-
I seem to (once again) be missing something pretty basic.
I am running under Windows XP Professional Service Pack 1 with all Hotfixes installed and Visual Studio .NET 2003 in Debug mode.
The following reports "You have the >Administrator< role."
using System.Security.Principal ;
using System.Security.Permissions ;
[PrincipalPermissionAttribute(SecurityAction.Demand ,Role="Administrator")]
private void Exercise15_2_Load( object sender, System.EventArgs e )
{
MessageBox.Show( "You have the >" + WindowsBuiltInRole.Administrator + "< role." );
}
If I uncomment the single statement a security exception is thrown ...
An unhandled exception of type ''System.Security.SecurityException'' occurred in mscorlib.dll
Additional information: Request for principal permission failed.
What am I missing?
--
-- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
--
谢谢,但是......
[PrincipalPermissionAttribu te(SecurityAction.Demand,Role =" BUILTIN \\Administr
ator")]
....给出与我相同的结果之前记录过。
-
- Thom Little - www.tlaNET.net - Thom Little Associates,Ltd。
-
" Jared Parsons [MSFT] QUOT; < JA ****** @ online.microsoft.com>在消息中写道
news:ul ************** @ TK2MSFTNGP11.phx.gbl ...
Thanks but ...
[PrincipalPermissionAttribute(SecurityAction.Demand ,Role="BUILTIN\\Administr
ator")]
.... gives the same result that I documented before.
--
-- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
--
"Jared Parsons [MSFT]" <ja******@online.microsoft.com> wrote in message
news:ul**************@TK2MSFTNGP11.phx.gbl...
尝试将属性修改为这个。
[PrincipalPermissionAttribute(SecurityAction.Demand,Role =" BUILTIN \Administra tor)]
- Jared Parsons [ MSFT]
ja******@online.microsoft.com
Try modifying your attribute to this.
[PrincipalPermissionAttribute(SecurityAction.Demand ,Role="BUILTIN\Administra tor")]
--
Jared Parsons [MSFT]
ja******@online.microsoft.com
Thom,
我查看了你的帖子,我会花一些时间在上面。我会尽快给你回复
.
感谢您的理解。
祝你好运,>
Jeffrey Tan
Microsoft在线合作伙伴支持
安全! - www.microsoft.com/security
此帖子按原样提供没有保证,也没有赋予任何权利。
Hi Thom,
I have reviewed your post, I will spend some time on it. I will reply to
you ASAP.
Thanks for your understanding.
Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
这篇关于安全角色例外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!