ajaxpro post html,asp.net 2.0 - AjaxPro Framework hitting timeout function? - Stack Overflow

在开发使用AjaxPro框架的ASP.NET 2.0聊天应用程序时,遇到发送消息后出现超时错误。问题可能在于服务器响应时间过长或者Ajax调用配置不正确。可以通过调整AjaxPro的超时设置、优化服务器端处理速度或检查网络连接来解决。同时,代码展示了客户端发送和接收消息的实现,包括输入框、获取新消息的函数以及服务器端的发送和获取消息的方法。
摘要由CSDN通过智能技术生成

I am trying to develop a chat application.I am using Asp.Net2.0 and vs2005.Iam using AjaxPro Framework for getting asynchronous calls to the server side.

My problem is when i send message im getting timeout error after a few seconds.What could be the problem and how will i resolve it?

My another doubt is that is there some serious problem in using AjaxPro Framework

Heres the code i have used in the client side to send messages

// Send messages

function sendMessage()

{

// input box for entering message

var ta_content = el("txtcontent");

// if the content input is not empty

if (ta_content.value.length > 0)

{

//the message show area

var div_recentMsg = el("recentMsg");

var clientUname=document.getElementById("").value;

var adminUname=document.getElementById("").value;

// send the message

AjaxProChat.SendMessage(clientUname,adminUname,ta_content.value);

// clear the input box

ta_content.value = "";

// roll up the web page with the messages

ta_content.scrollIntoView(false);

getNewMessage();

}

}

//Obtain the new messages

function getNewMessage()

{

// AjaxProChat.timeouPeriod(1800000);

// the user name

var username = document.getElementById("").value;

// the message show area

var div_recentMsg = el("recentMsg");

// Obtain the DataTable for the newest messages

var dt = AjaxProChat.GetNewMsg(username).value;

for (var i = 0;i < dt.Rows.length;i++)

{

// one message in response to one object

var oneMsg = document.createElement("span");

// the message sender and corresponding sent content

var strLine1 = dt.Rows[i].Sender + " says: (" + dt.Rows[i].SendTime + ")";

strLine1 = DealBrackets(strLine1);

// the content of the message

var strLine2 = dt.Rows[i].Contents;

strLine2 = DealBrackets(strLine2);

// show style

oneMsg.innerHTML = "

" + strLine1 + "
  " + strLine2 + "
";

oneMsg.style.padding = "2px 2px 2px 2px";

oneMsg.style.color = (dt.Rows[i].Sender == username) ? "blue" : "red";

oneMsg.style.fontFamily = "'Courier New'";

// attached to DOM

div_recentMsg.appendChild(oneMsg);

}

}

Heres the html code

Chatting Room

Input the message and click Send or press ENTER key:

style="width: 55%; height: 30px" type="text" runat="server" />

Heres the code for sending and receving messages i have written in server side

[AjaxPro.AjaxMethod]//code for sending messages

public void SendMessage(string Sender,string Receiver,string Content)

{

ChatBAL clsChat = new ChatBAL();

clsChat.SENDER = Sender;

clsChat.RECEIVER = Receiver;

clsChat.CONTENT = Content;

clsChat.SendMessage();

}

[AjaxPro.AjaxMethod]//code for getting latest message and returns datatable

public DataTable GetNewMsg(string UserName)

{

ChatBAL clsChat = new ChatBAL();

DataTable dtNewMsg =new DataTable();

try

{

clsChat.USERNAME = UserName;

dtNewMsg = clsChat.GetNewMessage();

}

catch

{

throw;

}

finally

{

clsChat = null;

}

return dtNewMsg;

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值