private string GetRedirectUri()
        {
            string absoluteApplicationPath = GetAbsoluteApplicationPath();

            if (string.IsNullOrEmpty(absoluteApplicationPath) || absoluteApplicationPath[absoluteApplicationPath.Length - 1] != '/')
            {
                absoluteApplicationPath += "/";
            }

            string redirectUri = absoluteApplicationPath + RequestCallback;

            var uriBuilder = new UriBuilder(redirectUri);

            if (UserLocationStorageType == UserLocationStorageType.RedirectUri)
            {
                var queryStringValues = Extensions.ParseQueryString(uriBuilder.Query);
                queryStringValues[ProviderParameter] = Name;
                queryStringValues[OptionsParameter]  = LoginOptions.ToString("D");

                if (MaintainUserLocation)
                {
                    string returnUrl = HttpContext.Current.Request.RawUrl;
                    if (!LoginOptions.HasFlag(AuthLoginOptions.StayOnCurrentPage) || !IsUrlLocalToHost(returnUrl))
                    {
                        returnUrl = HttpContext.Current.Request.QueryString[UrlParameter];
                    }
                    if (!IsUrlLocalToHost(returnUrl))
                    {
                        returnUrl = HttpContext.Current.Request.QueryString[ReturnUrlParameter];
                    }
                    if (!IsUrlLocalToHost(returnUrl))
                    {
                        returnUrl = SuccessUrl;
                    }

                    queryStringValues[UrlParameter] = returnUrl;
                }

                uriBuilder.Query = Extensions.BuildQueryString(queryStringValues);
            }

            return(uriBuilder.Uri.AbsoluteUri);
        }
        public Dictionary <string, string> GetFormContent()
        {
            var content = new Dictionary <string, string>()
            {
                { "login", Login },
                { "passwd", Passwd },
                { "PPFT", PPFT },
                { "PPSX", PPSX },
                { "SI", SI },
                { "type", Type.ToString() },
                { "NewUser", NewUser.ToString() },
                { "LoginOptions", LoginOptions.ToString() }
            };

            if (NeedsRemoteNGCParams)
            {
                content.Add("ps", Ps.ToString());
                content.Add("psRNGCEntropy", PsRNGCEntropy);
                content.Add("psRNGCDefaultType", PsRNGCDefaultType.ToString());
            }

            return(content);
        }