a.aspx 调用 xxx.ashx文件 传入 username
 createXMLHttpRequest();
        var url= "LoginValidate.ashx?username="+document.getElementById("username").value;
        xmlHttp.open("GET",url,true);
        xmlHttp.onreadystatechange=ShowResult;
        xmlHttp.send(null);
b.aspx 调用 xxx.ashx文件 传入 upmulu
   createXMLHttpRequest();
        var _upmulu=document.getElementById("ctl00_ContentPlaceHolder1_ctl00_suchengTextBox").value;
        
        var url= "../LoginValidate.ashx?upMuLu="+_upmulu;
        xmlHttp.open("GET",url,true);
        xmlHttp.onreadystatechange=ShowResult;
        xmlHttp.send(null)
在xxx.ashx文件中该如何读取这些参数  以下方法报错 :未将对象引用设置到对象的实例
  context.Response.ContentType = "text/plain";
        string username = context.Request.QueryString["username"].ToString();
        string upmulu = context.Request.QueryString["upMuLu"].ToString();
 
        if (upmulu != null)
        {
            if (UserNameExists(upmulu))
            {
                context.Response.Write("该车型已经加入");
            }
            else
            {
                context.Response.Write( upmulu + "该车型可以加入");
            }
        
        }
        if (username != null)
        {
            if (UserNameExists(username))
            {
                context.Response.Write("该用户名已经注册");
            }
            else
            {
                context.Response.Write(upmulu + "可以注册");
            }
        }
        context.Response.End();         System.Threading.Thread.Sleep(3000);
具体的该咋写 请给例子

解决方案 »

  1.   

    不是很会,我就知道在后台怎么弄,cs 中的应用,ashx中没有用过
      

  2.   

            string username = context.Request.QueryString["username"];
            string upmulu = context.Request.QueryString["upMuLu"];
      

  3.   

    自己设断点跟踪一下就知道哪里报错了,if( Request.QueryString["username"]!=null)
     string username = Request.QueryString["username"].ToString();
    if(Request.QueryString["upMuLu"]!=null)
    string upmulu = Request.QueryString["upMuLu"].ToString();
      

  4.   

    39364250--Asp.net(C#)高手交流群(高级群)!欢迎高手加盟!
      

  5.   


    当然不是!!!
     string username = context.Request.QueryString["username"].ToString();
            string upmulu = context.Request.QueryString["upMuLu"].ToString();如果是,你为社么还要多次一举调用 ToString 方法?