//end custom button initialise

    protected void register_client_scripts()
    {
        // Gets a reference to a Label control that not in
        // a ContentPlaceHolder
        DevExpress.Web.ASPxEditors.ASPxLabel mpLabel = (DevExpress.Web.ASPxEditors.ASPxLabel)Master.FindControl("lblResult");
        string _script = "";

        if (mpLabel != null)
        {
            _script = string.Format(@"function verify_user(){{
                    var us = document.getElementById('{0}').innerHTML; 
                    return us;
                    }}", mpLabel.ClientID);

            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "lg_key", _script, true);
        }
    }
Ejemplo n.º 2
0
    /// <summary>
    /// script to time page out just before session timeout when user is signed in
    /// </summary>
    private void CheckSessionTimeout()
    {
        string _script = "";

        DevExpress.Web.ASPxEditors.ASPxLabel mpLabel = (DevExpress.Web.ASPxEditors.ASPxLabel) this.FindControl("lblResult");

        if (mpLabel != null)
        {
            _script = string.Format(@"function verify_user(){{
                    var us = document.getElementById('{0}').innerHTML; 
                    return us;
                    }};", mpLabel.ClientID);
        }

        //time to redirect, 5 milliseconds before session ends
        string _t                   = this.Session.Timeout.ToString();
        string _pagename            = System.IO.Path.GetFileName(Request.Path);
        string str_Script           = "";
        int    _MilliSecondsTimeOut = (this.Session.Timeout * 60000) - 5;

        //141212 no auto logout pages (Publiship users only)
        if (isIntra()) // && _pagename == "Crm_Customer_Target.aspx")
        {
            str_Script = "";
        }
        else
        {
            str_Script = _script + @"
                var myTimeOut; +
                clearTimeout(myTimeOut); " +
                         "var sessionTimeout = " + _MilliSecondsTimeOut.ToString() + ";" +
                         "function doRedirect(){ var verify=verify_user();  if(verify != 'You are not signed in') {window.location.href='~/user_accounts/signin.aspx'}else{window.location.reload(true)}; }" + @"
                myTimeOut=setTimeout('doRedirect()', sessionTimeout); ";
        }

        ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(),
                                                "CheckSessionOut", str_Script, true);
        //}
    }