/// <summary>
    /// ลบข้อมูล Session และ Cookie
    /// </summary>
    /// <param name="CookieDelete">true = ลบ Cookie ด้วย</param>
    /// <returns></returns>
    public bool LoginDelete(bool CookieDelete = true)
    {
        clsDefault clsDefault = new clsDefault();
        bool       rtnValue   = false;

        try
        {
            if (System.Web.HttpContext.Current.Session[_sessionName] != null)
            {
                System.Web.HttpContext.Current.Session.Remove(_sessionName);
            }
            if (CookieDelete)
            {
                clsDefault.CookieDelete(_sessionName);
            }

            rtnValue = true;
        }
        catch (Exception ex)
        {
            rtnValue = false;
        }

        return(rtnValue);
    }
示例#2
0
    /// <summary>
    /// ลบข้อมูล Session และ Cookie
    /// </summary>
    /// <param name="CookieDelete">true = ลบ Cookie ด้วย</param>
    /// <returns></returns>
    public bool LoginDelete(bool CookieDelete = true)
    {
        #region Variable
        var clsDefault = new clsDefault();
        var result     = false;
        #endregion
        #region Procedure
        try
        {
            if (System.Web.HttpContext.Current.Session[_sessionName] != null)
            {
                System.Web.HttpContext.Current.Session.Remove(_sessionName);
            }
            if (CookieDelete)
            {
                clsDefault.CookieDelete(_sessionName);
            }

            result = true;
        }
        catch (Exception)
        {
            result = false;
        }
        #endregion
        return(result);
    }
    /// <summary>
    /// ลบข้อมูล Session และ Cookie
    /// </summary>
    /// <param name="CookieDelete">true = ลบ Cookie ด้วย</param>
    /// <returns></returns>
    public bool LoginDelete(bool CookieDelete=true)
    {
        clsDefault clsDefault = new clsDefault();
        bool rtnValue = false;

        try
        {
            if (System.Web.HttpContext.Current.Session[_sessionName] != null)
            {
                System.Web.HttpContext.Current.Session.Remove(_sessionName);
            }
            if (CookieDelete)
            {
                clsDefault.CookieDelete(_sessionName);
            }

            rtnValue = true;
        }
        catch (Exception ex)
        {
            rtnValue = false;
        }

        return rtnValue;
    }