Ejemplo n.º 1
0
        /// <summary>
        /// 从HttpContext中的Request中获取LogOffInfo。如果没有HttpContext,则返回null
        /// </summary>
        /// <returns></returns>
        public static LogOffInfo FromRequest()
        {
            LogOffInfo result = null;

            if (EnvironmentHelper.IsUsingWebConfig)
            {
                result = FromUrl(HttpContext.Current.Request.Url.ToString());
            }

            return(result);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 从Url中构造LogOffInfo
        /// </summary>
        /// <param name="url"></param>
        /// <returns></returns>
        public static LogOffInfo FromUrl(string url)
        {
            LogOffInfo result = new LogOffInfo();

            if (url.IsNotEmpty())
            {
                NameValueCollection urlParams = UriHelper.GetUriParamsCollection(url);

                result.SessionID     = urlParams.GetValue("asid", true, string.Empty);
                result.ApplicationID = urlParams.GetValue("appID", true, string.Empty);
                result.ReturnUrl     = urlParams.GetValue("ru", true, string.Empty);
                result.LogOffAll     = urlParams.GetValue("loa", true, true);

                result.AutoRedirect     = urlParams.GetValue("lar", true, false);
                result.CallbackUrl      = urlParams.GetValue("lou", true, string.Empty);
                result.CascadeLogOffUrl = urlParams.GetValue("clu", true, string.Empty);

                result.WindowsIntegrated = urlParams.GetValue("wi", true, false);
                result.LastUserID        = urlParams.GetValue("lu", true, string.Empty);
            }

            return(result);
        }