Example #1
0
        /// <summary>
        /// Gets the Name of the Cookie and the time out from the App.config file
        /// </summary>
        /// <param name="EndpointName"></param>
        /// <param name="CookieName"></param>
        /// <param name="CookieTimeout"></param>
        static void GetCookieSettingsFromConfig(string EndpointName, out string CookieName, out Int64 CookieTimeout)
        {
            CookieName = "SMSESSION";
            Int32         nTO    = 55;
            Configuration config = ConfigServices.GetConfig();

            if (config != null)
            {
                WebClientSettingsConfigSection configSection = (WebClientSettingsConfigSection)config.GetSection("WebClientUtilsSettings");
                if (configSection != null)
                {
                    EndpointPropertiesElement oEpElem = configSection.EndpointPropertiesCollection[EndpointName];
                    if (oEpElem != null)
                    {
                        EndpointPropertyElement oCookieNameElem    = oEpElem["SiteMinderCookieName"];
                        EndpointPropertyElement oCookieTimeoutElem = oEpElem ["SiteMinderCookieTimeout"];
                        if (oCookieNameElem != null)
                        {
                            CookieName = oCookieNameElem.Value;
                        }

                        if (oCookieTimeoutElem != null)
                        {
                            Int32.TryParse(oCookieTimeoutElem.Value, out nTO);
                        }

                        if (nTO <= 0)
                        {
                            nTO = 55;
                        }
                    }
                }
            }
            TimeSpan tsTimeout = new TimeSpan(0, nTO, 0);

            CookieTimeout = tsTimeout;
        }
 public int IndexOf(EndpointPropertiesElement element)
 {
     return(BaseIndexOf(element));
 }