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

C# 一般处理程序后台传来参数作为方法Act

2016-11-30 14:57 232 查看
private HttpRequest req;
private HttpResponse res;
private HttpContext ctx;

public void ProcessRequest(HttpContext context)
{

this.ctx = context;
this.req = ctx.Request;
this.res = ctx.Response;
res.ContentType = "text/plain";
string act = req["act"];
if (string.IsNullOrEmpty(act))
{
res.Write("没有参数");
}
else
{
Type type = this.GetType();
MethodInfo method = type.GetMethod(act);
if (method != null)
{
method.Invoke(this, null);
}
else
{
res.Write("没有这个方法");
}
}
res.End();
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: