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);
具体的该咋写 请给例子
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);
具体的该咋写 请给例子
string upmulu = context.Request.QueryString["upMuLu"];
string username = Request.QueryString["username"].ToString();
if(Request.QueryString["upMuLu"]!=null)
string upmulu = Request.QueryString["upMuLu"].ToString();
当然不是!!!
string username = context.Request.QueryString["username"].ToString();
string upmulu = context.Request.QueryString["upMuLu"].ToString();如果是,你为社么还要多次一举调用 ToString 方法?