/// <summary>
        /// Método aciando quando entrar na requisição.
        /// </summary>
        /// <param name="source"></param>
        /// <param name="eventArgs"></param>
        private void OnEnter(object source, EventArgs eventArgs)
        {
            _fOnEnterCalled = true;
            var         application = (Web.IHttpApplication)source;
            HttpContext context     = application.Context;

            OnAuthenticate(new FormsAuthenticationEventArgs(context));
            CookielessHelperClass cookielessHelper = context.CookielessHelper;

            if (Configuration.AuthenticationConfig.AccessingLoginPage(context, System.Web.Security.FormsAuthentication.LoginUrl))
            {
                context.SetSkipAuthorizationNoDemand(true, false);
                cookielessHelper.RedirectWithDetectionIfRequired(null, System.Web.Security.FormsAuthentication.CookieMode);
            }
            if (!context.SkipAuthorization)
            {
                context.SetSkipAuthorizationNoDemand(false, false);
            }
        }
        /// <summary>
        /// Método acionado quando deixar a requisição.
        /// </summary>
        /// <param name="source"></param>
        /// <param name="eventArgs"></param>
        private void OnLeave(object source, EventArgs eventArgs)
        {
            if (_fOnEnterCalled)
            {
                _fOnEnterCalled = false;
            }
            else
            {
                return;
            }
            var         application = (Web.IHttpApplication)source;
            HttpContext context     = application.Context;

            if ((context.Response.StatusCode == 0x191) && !context.Response.SuppressFormsAuthenticationRedirect)
            {
                string rawUrl = context.Request.RawUrl;
                if ((rawUrl.IndexOf("?" + ReturnUrlVar + "=", StringComparison.Ordinal) == -1) && (rawUrl.IndexOf("&" + ReturnUrlVar + "=", StringComparison.Ordinal) == -1))
                {
                    string str3;
                    string strUrl = null;
                    if (!string.IsNullOrEmpty(System.Web.Security.FormsAuthentication.LoginUrl))
                    {
                        strUrl = Configuration.AuthenticationConfig.GetCompleteLoginUrl(context, System.Web.Security.FormsAuthentication.LoginUrl);
                    }
                    if ((strUrl == null) || (strUrl.Length <= 0))
                    {
                        throw new System.Web.HttpException("Auth_Invalid_Login_Url");
                    }
                    CookielessHelperClass cookielessHelper = context.CookielessHelper;
                    if (strUrl.IndexOf('?') >= 0)
                    {
                        strUrl = RemoveQueryStringVariableFromUrl(strUrl, ReturnUrlVar);
                        string[] textArray1 = new string[] {
                            strUrl,
                            "&",
                            ReturnUrlVar,
                            "=",
                            System.Web.HttpUtility.UrlEncode(rawUrl, context.Request.ContentEncoding)
                        };
                        str3 = string.Concat(textArray1);
                    }
                    else
                    {
                        string[] textArray2 = new string[] {
                            strUrl,
                            "?",
                            ReturnUrlVar,
                            "=",
                            System.Web.HttpUtility.UrlEncode(rawUrl, context.Request.ContentEncoding)
                        };
                        str3 = string.Concat(textArray2);
                    }
                    int index = rawUrl.IndexOf('?');
                    if ((index >= 0) && (index < (rawUrl.Length - 1)))
                    {
                        str3 = str3 + "&" + rawUrl.Substring(index + 1);
                    }
                    cookielessHelper.SetCookieValue('F', null);
                    cookielessHelper.RedirectWithDetectionIfRequired(str3, System.Web.Security.FormsAuthentication.CookieMode);
                    context.Response.Redirect(str3, false);
                }
            }
        }