Ejemplo n.º 1
0
        private HttpWebRequest CreateRequest(string sPostUrl, string baseURL, string _userId,
                                             string _password, string method, bool isNewCookie)
        {
            var sec          = new PawnCouchConcurrentAccessSecurity(baseURL, _userId, _password);
            var webRequester = (HttpWebRequest)WebRequest.Create(sPostUrl);

            if (sec.GetSession(isNewCookie) == null)
            {
                log.Error("DB Creation/DB Secure failed due to session failure");
                log.Error("User:"******" : post url" + sPostUrl);
                return(null);
            }
            webRequester.Headers.Add("Cookie", "AuthSession=" + sec.GetSession(isNewCookie).Value);
            webRequester.Method = method;
            webRequester.Headers.Add("Accept-Charset", "utf-8");
            webRequester.Headers.Add("Accept-Language", "en-us");
            webRequester.ContentType = "application/json";
            webRequester.KeepAlive   = true;
            return(webRequester);
        }
        private HttpWebRequest CreateRequest(string sGetURL, string baseURL, string _userId, string _password, bool isNewCookie)
        {
            var sec = new PawnCouchConcurrentAccessSecurity(baseURL, _userId, _password);

            if (sec.GetSession(isNewCookie) == null)
            {
                return(null);
            }
            var webRequester = (HttpWebRequest)WebRequest.Create(sGetURL);

            webRequester.Headers.Add("Cookie", "AuthSession=" + sec.GetSession(isNewCookie).Value);
            webRequester.Method = "DELETE";
            webRequester.Headers.Add("Accept-Charset", "utf-8");
            webRequester.Headers.Add("Accept-Language", "en-us");
            webRequester.ContentType = "application/json";
            //webRequester.KeepAlive = true;
            if (setReqTimeout)
            {
                webRequester.Timeout = reqTimeoutVal;
            }
            return(webRequester);
        }