コード例 #1
0
        /// <summary>
        /// Stores the specified organization identifier and redirects to originally requested URL.
        /// </summary>
        /// <param name="organizationId">The organization identifier.</param>
        internal static void SelectOrganization(Guid organizationId, string redirectUrl, bool validateRedirectUrl, HtmlGenericControl errorDiv)
        {
            try
            {
                if (FrameworkConfiguration.Current.WebApplication.CustomUrl.Enabled)
                {
                    if (validateRedirectUrl)
                    {
                        ActiveInstanceControl.ValidateRedirectUrl(ref redirectUrl, true);
                    }

                    errorDiv.Page.Session.Clear();

                    errorDiv.Page.Response.Redirect(CustomUrlProvider.GetVanityUri(organizationId, Guid.Empty, redirectUrl));
                }
                else
                {
                    UserContext.Current.SelectOrganization(organizationId);

                    //if (validateRedirectUrl)
                    ActiveInstanceControl.ValidateRedirectUrl(ref redirectUrl, true);

                    if (!string.IsNullOrEmpty(redirectUrl))
                    {
                        errorDiv.Page.Response.Redirect(redirectUrl);
                    }
                }
            }
            catch (AuthenticationException ex)
            {
                ActiveInstanceControl.ShowError(ex.Message, errorDiv);
            }
        }
コード例 #2
0
        /// <summary>
        /// Selectes the specified instance and redirects to specified URL.
        /// </summary>
        /// <param name="instanceId">The instance identifier to select.</param>
        /// <param name="redirectUrl">The URL to redirect to.</param>
        internal static void SelectInstance(Guid instanceId, string redirectUrl, bool validateRedirectUrl, HtmlGenericControl errorPanel)
        {
            try
            {
                UserContext user = UserContext.Current;

                if (FrameworkConfiguration.Current.WebApplication.CustomUrl.Enabled)
                {
                    if (validateRedirectUrl)
                    {
                        ValidateRedirectUrl(ref redirectUrl, true);
                    }

                    errorPanel.Page.Session.Clear();

                    errorPanel.Page.Response.Redirect(CustomUrlProvider.GetVanityUri(user.OrganizationId, instanceId, redirectUrl));
                }
                else
                {
                    user.SelectInstance(instanceId);

                    //if (validateRedirectUrl)
                    ValidateRedirectUrl(ref redirectUrl, true);

                    if (!string.IsNullOrEmpty(redirectUrl))
                    {
                        errorPanel.Page.Response.Redirect(redirectUrl);
                    }
                }
            }
            catch (AuthenticationException ex)
            {
                ShowError(ex.Message, errorPanel);
            }
        }