求助!是想插入数据,但是总是提交失败。断点测试的时候发现,录入数据后程序根本就没有经过客户端。这是什么原因啊?求高手解答!!
JS中相关代码:
function RequestCallBack()
{
if(xmlHttpReq.readyState == 4)
{
var str=xmlHttpReq.responseText;
alert("carType="+carType); //
alert("boss="+boss);//
alert("wall="+wall);//这三项弹出的值是对的 if(str=="true" && str!= null)
{
alert("提交成功!");
}
else
{
alert("提交失败!");
}
}
}客户端cs文件相关代码:
if (Request.QueryString["str"] != null && Request.QueryString["carType"] != null && Request.QueryString["boss"] != null && Request.QueryString["wall"] != null && Request.QueryString["url"] != null)
{
string str = Request.QueryString["str"].ToString();
string boss = Request.QueryString["boss"].ToString();
string wall = Request.QueryString["wall"].ToString();
string carType = Request.QueryString["carType"].ToString();
string url = Request.QueryString["url"].ToString();
Response.Write(EpProcedure.addboss(carType, str, boss, wall, url));
Response.End();
}
JS中相关代码:
function RequestCallBack()
{
if(xmlHttpReq.readyState == 4)
{
var str=xmlHttpReq.responseText;
alert("carType="+carType); //
alert("boss="+boss);//
alert("wall="+wall);//这三项弹出的值是对的 if(str=="true" && str!= null)
{
alert("提交成功!");
}
else
{
alert("提交失败!");
}
}
}客户端cs文件相关代码:
if (Request.QueryString["str"] != null && Request.QueryString["carType"] != null && Request.QueryString["boss"] != null && Request.QueryString["wall"] != null && Request.QueryString["url"] != null)
{
string str = Request.QueryString["str"].ToString();
string boss = Request.QueryString["boss"].ToString();
string wall = Request.QueryString["wall"].ToString();
string carType = Request.QueryString["carType"].ToString();
string url = Request.QueryString["url"].ToString();
Response.Write(EpProcedure.addboss(carType, str, boss, wall, url));
Response.End();
}
其次请去掉缓存如下 context.Response.Buffer = true;
context.Response.ExpiresAbsolute = DateTime.Now.AddDays(-1);
context.Response.AddHeader("pragma", "no-cache");
context.Response.AddHeader("cache-control", "");
context.Response.CacheControl = "no-cache";
context.Response.ContentType = "text/plain";
除了上面的,建议你写一些四值作测试,直接运行ashx文件,看看能不能出来,有没有什么特殊的地方.