public class AjaxHandler : System.Web.IHttpHandler
    {
        #region IHttpHandler 成员
        public bool IsReusable
        {
            get { return false; }
        }
        HttpContext context;
        public void ProcessRequest(HttpContext _context)
        {
            context = _context;
            System.Web.UI.Page page = new System.Web.UI.Page();  
            //因为我现在动态加载了一个用户控件,但我的用户控件里面的取值是通过Request.QueryString取得数据
            //但是因为我这里是通过new System.Web.UI.Page();出来的对像
            //所以默认他的Request.QueryString是空对像
            //这个时候我如何把我的context.Request.QueryString赋值给他呢?
            Control userControl = page.LoadControl(template + ".ascx");
        }//谢谢

解决方案 »

  1.   

    也就是将当前IhttpHeader中的Request.QueryString赋值给新创建的Page对像,谢谢
      

  2.   

    关注是不是可以动态生成URL来访问新创建的Page对像?
      

  3.   

    当前IhttpHeader中的Request.QueryString获取不到?获取到了            //因为我现在动态加载了一个用户控件,但我的用户控件里面的取值是通过Request.QueryString取得数据
                //但是因为我这里是通过new System.Web.UI.Page();出来的对像
                //所以默认他的Request.QueryString是空对像
                //这个时候我如何把我的context.Request.QueryString赋值给他呢?把原来的Request.QueryString换成context.Request.QueryString
      

  4.   

    或者是赋值用户控件的Request 
    但我查看转到定义发现Requery只有get属性
    public HttpRequest Request { get; }
      

  5.   


    Request是只读的,只能请求,不能赋值
      

  6.   

    RE:Request是只读的,只能请求,不能赋值
    那我用new page load进来的对像,如何来取当前httpHeader的request对像呢?
      

  7.   

            System.Collections.Specialized.NameValueCollection c = Request.QueryString;
            for (int i = 0; i < c.Count; i++)
            {
                string value = c[i].ToString();
            }
      

  8.   

    难道我只能自己再发明一个        
    public HttpRequest UserRequest { get; set; }
    吗?
      

  9.   

    System.Collections.Specialized.NameValueCollection c = Request.QueryString;
    for (int i = 0; i < c.AllKeys.Length; i++)
    {
        string key = c.Keys[i];//获取键名
        string value= c.GetKey(i);//获取键值
    }
      

  10.   

    System.Collections.Specialized.NameValueCollection
    问题是:
    我如何把这个对像赋值给UserControl
    他的Requery只有Get没有Set