本文介绍了使用母版页请求会话超时警报的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hai All,

我正在使用ajaxtoolkit的modalpopupextender控件提醒用户即将到期的会话。如果网站是理想的话,我每5分钟需要一次,如果你想要的话,它会显示你的想法正在经历的警报信息如果它可以扩展,那么你已经重置了那样的时间

i写了我的代码就像这样。但是dnt知道我在脚本中得到错误它没有正常工作可以任何人打电话给我怎么样执行此任务

Hai All,
I am using ajaxtoolkit’s modalpopupextender control to alert user about expiring session.what i need for every 5mins if the site is ideal it will show alert message your seesion is expering if u want to extend if it is ok then u have reset the time like that for that
i wrote my code like this.but dnt knw i am getting error in script its not wroking properly can any one tel me how to do this task

<script type="text/javascript">
            function ShowAlert() {
                $find('mpe_alert').show();
            }
            function hide() {
                $find('mpe_alert').hide();
            }
            function onOk() {
                $find('mpe_alert').hide();
                _doPostBack($find('btnOk'), '')
            }




$ b $身体标签中的b我这样担心



in body tag i worote like this

body>
    <form id="form1" runat="server">
        <%--  <asp:ScriptManager ID="ScriptManager1" runat="server" AsyncPostBackTimeout="180" ScriptMode="Release" EnableScriptGlobalization="true" EnablePageMethods="true" >
    </asp:ScriptManager>--%>
        <telerik:RadScriptManager  runat="server" ID="RadScriptManager1" EnablePageMethods="true" />
        <telerik:RadSkinManager ID="QsfSkinManager"  runat="server" Skin="Metro" ShowChooser="false" />
   <asp:HiddenField ID="hdnSessionExpire" runat="server" />
            <cc1:ModalPopupExtender ID="mpe_alert"  runat="server" TargetControlID="hdnSessionExpire"

                PopupControlID="pnlAlert" CancelControlID="btnCancel" OkControlID="btnOk" BehaviorID="mpe_alert"  önOkScript="onOk()">
            </cc1:ModalPopupExtender>
            <asp:Panel ID="pnlAlert" runat="server" Height="100px"

                Style="display: none" Width="250px">
                <table width="100%">
                    <tr>
                        <td align="left" style="font-weight: bold; font-family: Arial">
                            <asp:Label ID="lblSessionAlert" runat="server" Text="Session Expiry Alert"></asp:Label>
                    </tr>
                </table>
                <table>
                    <tr>
                        <td colspan="2">
                            <asp:Label ID="lblMessage" runat="server" Font-Bold="true" Text="Your session is going to expire in 1 minute. Would you like to extend your session?"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <br />
                        </td>
                    </tr>
                    <tr>
                        <td align="right">
                            <asp:Button Text="Yes" value="Yes" runat="server" ID="btnOk" />
                        </td>
                        <td align="left">
                            <asp:Button Text="Cancel" value="No" runat="server" ID="btnCancel" />
                        </td>
                    </tr>
                </table>
            </asp:Panel>

        </div>



这是我的.cs文件代码


and this is my .cs file code

Session.Timeout = 5;
           int MillisecondsTimeout = (Session.Timeout * 60000) - 120000;
           string strScriptAlert = @"window.setInterval('ShowAlert()' , " + MillisecondsTimeout.ToString() + @");   ";
           ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Alert", strScriptAlert, true);

           int Timeout = (Session.Timeout * 60000) - 60000;
           string strScriptHideAlert = @"window.setInterval('hide()' , " + Timeout.ToString() + @");   ";
           ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "HideAlert", strScriptHideAlert, true);
           Response.AppendHeader("Refresh", Convert.ToString((Session.Timeout * 60)) + ";URL=Login.aspx");

推荐答案




这篇关于使用母版页请求会话超时警报的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 17:38