我怎样才能调用服务器方法,当用户关闭页面 [英] How can I call a server method when the user close the page

查看:164
本文介绍了我怎样才能调用服务器方法,当用户关闭页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想删除的用户后,服务器临时文件关闭页面(我认为我没有这个回调的服务器上默认),

I want to remove a temp file from the server after the user close the page (I assumed I don't have this callback on the server by default),

我试着使用调用服务器端方法( ICallbackEventHandler 执行),当用户关闭网页,但问题是,服务器端的方法不火的这种情况下(关闭页面),它只响应,如果页面仍然打开。我不preFER停止关闭页面,直到服务器的响应,并派出回电手动关闭该页面。

I tried to call a server side method using (ICallbackEventHandler implementation) when the user close the page, but the problem is that the server side method doesn't fire in this case (closing the page), it only response if the page still opened. and I don't prefer to stop closing the page until the server response and send its call back to close the page manually.

在情况下,我必须停止关闭页面,请帮助我的最好方法。

In case I must stop closing the page, kindly help me with the best way.

在此先感谢

推荐答案

我觉得它可能只是更审慎的删除后,一定时间内的文件,说24个小时,在最近访问的基础。也就是说,谁没开封在24小时内的所有文件被删除。

I think it might just be more prudent to delete the file after some time period, say 24 hours, on a recently-accessed basis. That is, all files who haven't been touched in 24 hours get deleted.

另外,你可以轮询的AJAX,并尽快您没有收到与一段时间内的用户的识别标记门限>的轮询间隔,删除相关文件的请求。

Alternatively, you could poll with AJAX, and as soon as you don't receive a request with the user's identifying token within some time threshhold > the polling interval, delete the relevant file.

这篇关于我怎样才能调用服务器方法,当用户关闭页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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