public ServerResponse Post(PostParms parm)
        {
            var response = new ServerResponse();
            var url = string.Format("{0}{1}", _domain, parm.EndPoint);
            var request = (HttpWebRequest)WebRequest.Create(url);
            if (parm.TabId > 0) request.Headers["TabID"] = parm.TabId.ToString();
            if (parm.TabId > 0) request.Headers["ModuleID"] = parm.ModuleId.ToString();
            request.Headers[RqVerifTokenNameNoUndescrores] = _inputFieldVerificationToken;
            request.ContentType = "text/json";
            request.Method = "POST";
            request.KeepAlive = false;
            request.CookieContainer = _sessionCookiesContainer;
            //request.ReadWriteTimeout = 90;

            using (var streamWriter = new StreamWriter(request.GetRequestStream()))
            {
                streamWriter.Write(parm.Content);
                streamWriter.Flush();
                streamWriter.Close();

                var httpResponse = (HttpWebResponse) request.GetResponse();
                using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
                {
                    var result = streamReader.ReadToEnd();
                }
            }
            return response;
        }
        public ServerResponse Get(GetParms parm)
        {
            var url = string.Format("{0}{1}{2}", _domain, parm.EndPoint, parm.QueryString);

            var request = (HttpWebRequest) WebRequest.Create(url);
            if(parm.TabId > 0) request.Headers["TabID"] = parm.TabId.ToString();
            if(parm.TabId > 0) request.Headers["ModuleID"] = parm.ModuleId.ToString();
            request.Method = "GET";
            request.KeepAlive = false;
            request.CookieContainer = _sessionCookiesContainer;
            request.ReadWriteTimeout = 90;
            var response = new ServerResponse();
            using (var httpResponse = (HttpWebResponse) request.GetResponse())
            {
                response.Status = httpResponse.StatusCode;
                using (var s = httpResponse.GetResponseStream())
                {
                    if (s != null)
                        using (var sr = new StreamReader(s, Encoding.UTF8))
                    {
                        response.Data = sr.ReadToEnd();
                    }
                }
            }

            return response;
        }
        public ServerResponse Post(PostParms parm)
        {
            var response = new ServerResponse();

            using (var client = GetUploadContentClient())
            {
                var rqHeaders = client.DefaultRequestHeaders;
                rqHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                rqHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("text/html", 0.5d));
                rqHeaders.Add("X-Requested-With", "XMLHttpRequest");

                if (parm.TabId > 0) rqHeaders.Add("TabID", parm.TabId.ToString());
                if (parm.TabId > 0) rqHeaders.Add("ModuleID", parm.ModuleId.ToString());

                var url = string.Format("{0}{1}", _domain, parm.EndPoint);
                var uri = new Uri(url);

                var result = client.PostAsJsonAsync(uri.ToString(), parm.Content).Result;
                result.EnsureSuccessStatusCode();

                //return new HttpResponseMessage { StatusCode = HttpStatusCode.Accepted };
            }

            return response;
        }