这是什么错误htmlfile:未知的运行时错误? [英] What is this Error- htmlfile: Unknown Runtime Error?

查看:73
本文介绍了这是什么错误htmlfile:未知的运行时错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经编写了以下AJAX代码,以从.aspx页面获取响应.但是出现错误htmlfile:下一行以粗体显示的未知运行时错误:

I have written the following AJAX code for getting response from .aspx page. But getting an error htmlfile: Unknown Runtime Error for the below line in bold:

function CheckCode() {
var sname = document.getElementById('<%=txtName.ClientID %>').value;
if (sname != "" || sname != null) {
request = new XMLHttpRequest();
request.onreadystatechange = function () {
if (request.readyState == 4 && request.status == 200) {
document.getElementById('<%=lblNameError.ClientID %>').innerHTML = request.responseText;
}
}
var loc = "CheckCode.aspx?name=" + sname;
request.open("GET", loc, true);
request.send();
}
in Checkcode.aspx

//..some code
if (dr.Read())
{
checkno = 0;
Response.Write("already exists");
}
else
{
checkno = 1;
Response.Write("continue");
}

推荐答案

当您使用"Response.Write(........)"发送任何响应时,它可能会有一些以前的值.
尝试先清除它,然后结束它.

试试这个
================================================== =====
When you are sendind any response using "Response.Write(........)", then it may have some previous value.
try to clear it first and then ending it.

try this
=======================================================
Response.Clear();   //Add this line
if (dr.Read())
{
checkno = 0;
Response.Write("already exists");
}
else
{
checkno = 1;
Response.Write("continue");
}
Response.End();    //And add this


================================================== =====
而且你很好. :)


=======================================================
And you are good to go. :)


在这里您可以找到已解决的链接

ASP.NET UpdatePanel错误htmlfile:未知的运行时错误,updatePanelElement .innerHTML = rendering [
Here you go for the solved link

ASP.NET UpdatePanel Error htmlfile: Unknown runtime error, updatePanelElement.innerHTML=rendering[^]


这篇关于这是什么错误htmlfile:未知的运行时错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆