您的位置:首页 > 编程语言

给执行代码加 执行权限 角色管理[System.Security.Permission]

2009-08-23 21:39 615 查看
更多详细:http://weblogs.asp.net/scottgu/archive/2005/11/14/430598.aspx

public partial class Test : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)
{

}

protected void Button1_Click(object sender, EventArgs e)
{
Authors aucmd = new Authors();
Response.Write(aucmd.pvHello());
}
}
//[PrincipalPermission(SecurityAction.Demand, Authenticated = true)]

public class Authors
{
// Methods
[PrincipalPermission(SecurityAction.Demand, Role = "Admin")]
public string pvHello()
{
return DateTime.Now.ToString();
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐