Microsoft.Protocols.TestSuites.MS_AUTHWS.TestSuiteBase.GetCookieName C# (CSharp) Method

GetCookieName() protected method

This method is used to get the specified cookie name exists on the server.
protected GetCookieName ( int cookieIndex, CookieContainer cookieContainer ) : string
cookieIndex int The cookie index which name to be returned.
cookieContainer System.Net.CookieContainer The cookie container which contains the specified cookie.
return string
        protected string GetCookieName(int cookieIndex, CookieContainer cookieContainer)
        {
            string cookieName = string.Empty;
            CookieCollection cookieCollection = cookieContainer.GetCookies(new Uri(this.GetFormsAuthenticationServiceUrl()));
            
            if (cookieCollection != null)
            {
                if (cookieCollection.Count != 0)
                {
                    Cookie[] cookies = new Cookie[cookieCollection.Count];
                    cookieCollection.CopyTo(cookies, 0);
                    cookieName = cookies[cookieIndex].Name;
                }
            }

            return cookieName;
        }