Exemplo n.º 1
0
        /////////////////////////////////////////////////////////////////////////////
        /////////////////////////////////////////////////////////////////////////////
        /////////////////////////////////////////////////////////////////////////////
        private Collection <string> SetPropertyValuesWeb(SettingsPropertyValueCollection values, bool cacheIsMoreFresh)
        {
            bool anyFailures = false;
            Collection <string> errorList = null;
            ClientFormsIdentity id        = Thread.CurrentPrincipal.Identity as ClientFormsIdentity;

            try {
                errorList   = SetPropertyValuesWebCore(values, cacheIsMoreFresh);
                anyFailures = (errorList != null && errorList.Count > 0);
            }
            catch (WebException) {
                if (id == null || _HonorCookieExpiry)
                {
                    throw;
                }
                anyFailures = true;
            }

            if (!_HonorCookieExpiry && anyFailures)
            {
                // if there were failures, try re-validating the ClientFormsIdentity
                //    and try again
                if (id != null)
                {
                    id.RevalidateUser();
                    errorList = SetPropertyValuesWebCore(values, cacheIsMoreFresh);
                }
            }
            return(errorList);
        }
Exemplo n.º 2
0
        /////////////////////////////////////////////////////////////////////////////
        /////////////////////////////////////////////////////////////////////////////
        /////////////////////////////////////////////////////////////////////////////
        private void GetPropertyValuesFromWeb()
        {
            GetPropertyValuesFromWebCore(_HonorCookieExpiry);

            // Any failures?
            bool anyFailures = (_PropertyValues.Count < _Properties.Count);

            if (!_HonorCookieExpiry && anyFailures)
            {
                // if there were failures, try re-validating the ClientFormsIdentity
                //    and try again

                ClientFormsIdentity id = Thread.CurrentPrincipal.Identity as ClientFormsIdentity;

                if (id != null)
                {
                    id.RevalidateUser();
                    GetPropertyValuesFromWebCore(true);
                }
            }
        }