public static ActivationParameters LoadActivationParameters(HttpContext context)
        {
            ActivationParameters parameters = null;

            FormDataCookie cookie = new FormDataCookie(SettingsHelper.SavedFormDataName);
            if (context.Request.Form != null && context.Request.Form.AllKeys.Count<string>() != 0)
            {
                // get from current request's form data
                parameters = new ActivationParameters(context.Request.Form);
            }
            else if (cookie.Load() && cookie.IsLoaded && cookie.FormData.AllKeys.Count<string>() > 0)
            {
                // if form data does not exist, it must be because of the sign in redirection, at the time form data is saved in the cookie 
                parameters = new ActivationParameters(cookie.FormData);
                // clear the cookie after using it
                cookie.Clear();
            }
            else
            {
                parameters = (ActivationParameters)context.Session[SettingsHelper.SavedFormDataName];
            }
            return parameters;
        }
예제 #2
0
        public static ActivationParameters LoadActivationParameters(HttpContext context)
        {
            ActivationParameters parameters = null;

            FormDataCookie cookie = new FormDataCookie(SettingsHelper.SavedFormDataName);

            if (context.Request.Form != null && context.Request.Form.AllKeys.Count <string>() != 0)
            {
                // get from current request's form data
                parameters = new ActivationParameters(context.Request.Form);
            }
            else if (cookie.Load() && cookie.IsLoaded && cookie.FormData.AllKeys.Count <string>() > 0)
            {
                // if form data does not exist, it must be because of the sign in redirection, at the time form data is saved in the cookie
                parameters = new ActivationParameters(cookie.FormData);
                // clear the cookie after using it
                cookie.Clear();
            }
            else
            {
                parameters = (ActivationParameters)context.Session[SettingsHelper.SavedFormDataName];
            }
            return(parameters);
        }