- 注册时间
- 2014-3-4
- 最后登录
- 2021-2-2
- 阅读权限
- 10
- 积分
- 158
- 精华
- 0
- 帖子
- 17
|
请教:
1、不注释掉 context.Response.End(); 就出报错,请问是不是try里的finally没执行完的原因?
2、缺少context.Response.End();有没有影响?
public void ProcessRequest(HttpContext context)
{
//write your handler implementation here.
String methodName = context.Request["method"];
if (String.IsNullOrEmpty(methodName)) return;
//invoke method
Type type = this.GetType();
MethodInfo method = type.GetMethod(methodName);
object[] paras = { context };
try
{
BeforeInvoke(methodName);
method.Invoke(this, paras);
}
catch (Exception ex)
{
……略
}
finally
{
AfterInvoke(methodName);
}
}
public void LoadTree(HttpContext context)
{
String sql = "select modelid id,modelname name,parentid pid from sys_model where modelid>8";
ArrayList folders = Utils.Tools.DataTableToArrayList(DBHelper.SQLHelper.ExcuteDataTable(Utils.Config.connStrMIS, sql));
String json = Utils.JSON.Encode(folders);
context.Response.ContentType = "application/json";
context.Response.Write(json);
//context.Response.End();
}
|
|