PageBase类 --AJAX请求 作为请求页面的基类

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
///PagebaseForNoVidition 的摘要说明
/// </summary>
public class PagebaseForNoVidition:IHttpHandler
{
    public PagebaseForNoVidition()
    {
        //
        //TODO: 在此处添加构造函数逻辑
        //
    }
    public readonly bool autoR = false;
    public PagebaseForNoVidition(bool autoR){
        this.autoR = autoR;
    }
    public virtual void ProcessRequest(HttpContext context) {
        if (autoR) {
            string result = string.Empty;
            try {
                object o = this.GetType().InvokeMember(context.Request["callback"],System.Reflection.BindingFlags.InvokeMethod,null,this,new object[]{context});
                if (o != null) {
                    result = o.ToString();
                }
            }
            catch (System.Threading.ThreadAbortException ex)
            {
            }
            catch (Exception ex)
            {
                //
            }
            context.Response.Clear();
            context.Response.Write(result);
            context.Response.End();
        }
    }
    public bool IsReusable
    {
        get { return false; }
    }
}


你可能感兴趣的:(PageBase类 --AJAX请求 作为请求页面的基类)