Пример #1
0
        private static string Login()
        {
            string          urlParams = "/auth/login";
            string          method    = "POST";
            List <string[]> headers   = new List <string[]>();
            //headers.Add(new string[] { "Content-type", "application/x-www-form-urlencoded" });
            string contentType = "application/x-www-form-urlencoded";
            string body        = "username=admin&password=administrator";

            webRespFac = new WebResponseFactory(webReqFac.BuildRequest(urlParams, method, contentType, headers, body));
            HttpWebResponse response     = webRespFac.ExecuteRequest();
            string          cookieHolder = response.GetResponseHeader("set-cookie");

            string[] cookieHolderPieces = cookieHolder.Split(new string[] { "; " }, StringSplitOptions.None);
            return(cookieHolderPieces[0]);
        }