asp.net 简单方法级别权限控制,初稿
时间:2011-06-06 来源:xvipservice
public partial class _Default : System.Web.UI.Page
{
public delegate void mydelegete();
protected void Page_Load(object sender, EventArgs e)
{
Exec(delegate()
{
Response.Write("xxxxxxxx" + MethodBase.GetCurrentMethod().Name + "<br/>");
Response.Write(a() + "<br/>");
Response.Write(TextBox1.Text);
});
}
public int a()
{
return 0;
}
public void Exec(mydelegete md)
{
StackTrace trace = new StackTrace();
MethodBase methodName = trace.GetFrame(1).GetMethod();//得到上一级方法调用
Response.Write(methodName.DeclaringType.FullName + "<br/>");
Response.Write(methodName.Name + "<br/>");
md();
}
}
相关阅读 更多 +