简体   繁体   English

asp.net定期向服务器发送消息

[英]asp.net periodically send messages to server

I'm using VS2010,C# for developing ASP.NET. 我正在使用VS2010,C#开发ASP.NET。 I want to send periodical messages to server in order that server knows which user is really active (with open windows), so that when a user closes window or changes url (instead of clicking on logout button), my server can detect user sign out and can close his session. 我想向服务器发送定期消息,以便服务器知道哪个用户真正处于活动状态(打开的窗口),以便当用户关闭窗口或更改URL(而不是单击注销按钮)时,我的服务器可以检测到用户注销并可以结束他的会议。 what are my options here? 我在这里有什么选择? I don't think JavaScript would be safe as I should probably update my database (is there any other way? for instance can I call an address in my JS function?) 我认为JavaScript不安全,因为我可能应该更新数据库(还有其他方法吗?例如,我可以在JS函数中调用地址吗?)

Another solution would be to use AJAX to send server side messages to server, is it safe and efficient? 另一个解决方案是使用AJAX将服务器端消息发送到服务器,它既安全又高效? what is the best way? 什么是最好的方法? security is really important for me 安全对我来说真的很重要

将ajax与JQuery一起使用是一个不错的选择

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM