减少Bot框架WebChat IFrame会话超时

问题描述 投票:1回答:1

我陷入了一个安全问题。目前,如果网络聊天闲置超过30分钟,则IFrame网聊会话将过期,并将消息显示为“联系网站管理员”。我想把时间从30分钟减少到15分钟。如何使用C#实现这一目标。

先感谢您。

c# session botframework web-chat
1个回答
0
投票

您可以使用自定义js代码来实现这一点。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
    <link rel="shortcut icon" href="" type="image/x-icon" />
    <script type="text/javascript">
        // Set timeout variables.
        var timoutWarning = 6000; // Display warning in 6 Sec.
        var timoutNow = 10000; // Timeout in 10 Sec.

        var warningTimer;
        var timeoutTimer;

        // Start timers.
        function StartTimers() {
            warningTimer = setTimeout("IdleWarning()", timoutWarning);
            timeoutTimer = setTimeout("IdleTimeout()", timoutNow);
        }

        // Reset timers.
        function ResetTimers() {
            clearTimeout(warningTimer);
            clearTimeout(timeoutTimer);
            StartTimers();

        }

        // Show idle timeout warning dialog.
        function IdleWarning() {
            alert("COntact your admin");
        }

        // Logout the user.
        function IdleTimeout() {
            window.location = "#";
        }
    </script>
</head>
<body onload="StartTimers();" onmousemove="ResetTimers();">
    <form id="form1" runat="server">
    <div id="timeout">
        <h1>
            Session About To Timeout</h1>
        <p>
            You will be automatically logged out in 1 minute.<br />
        To remain logged in move your mouse over this window.
    </div>
    <table id="table1" align="center" border="1" width="800" cellpadding="0" cellspacing="0">
        <tr>
            <td>
                Hello World
            </td>
        </tr>
    </table>
    </form>
</body>
</html>

我希望这会帮助你

© www.soinside.com 2019 - 2024. All rights reserved.