DoHttpMethod() публичный статический Метод

public static DoHttpMethod ( string method, string uri, NetworkCredential credential, string requestText, bool readResponse = true ) : string
method string
uri string
credential System.Net.NetworkCredential
requestText string
readResponse bool
Результат string
Пример #1
0
        public static string GetConfigValue(string uri, string key, NetworkCredential credential)
        {
            uri = uri + "?key=" + key;
            string responseText = HttpUtil.DoHttpMethod("GET", uri, credential, null);

            return(responseText);
        }
Пример #2
0
        public static string GetOrInitConfigValue(string napkinServerUri, string configPath, string key, string defaultValue, NetworkCredential credential)
        {
            string uri          = napkinServerUri + "/config/" + configPath + "?key=" + key;
            string responseText = HttpUtil.DoHttpMethod("GET", uri, credential, null);

            Debug.Print("GOT " + key + "=" + responseText);
            if ((responseText == null) || (responseText == ""))
            {
                HttpUtil.DoHttpMethod("PUT", uri, credential, defaultValue, false);
                return(defaultValue);
            }
            else
            {
                return(responseText);
            }
        }
Пример #3
0
        public static void StartSequence(string napkinServerUri, string deviceId, NetworkCredential credential)
        {
            Thread.Sleep(5000);

            string deviceConfigUri = napkinServerUri + "/config/" + deviceId;
            string responseText    = HttpUtil.DoHttpMethod("GET", deviceConfigUri, credential, null);

            Debug.Print("Config: " + responseText);

            Thread.Sleep(2000);

            string deviceConfigPostUri = napkinServerUri + "/config?sub=" + deviceId;

            HttpUtil.DoHttpMethod("POST", deviceConfigPostUri, credential, "", false);

            Thread.Sleep(2000);

            int start_count = ConfigUtil.IncrementCounter(napkinServerUri, deviceId, "napkin.systems.start_count~i", credential);

            Debug.Print("Starts: " + start_count);
        }
Пример #4
0
 public static void PostConfigNode(string uri, string sub, NetworkCredential credential)
 {
     uri = uri + "?sub=" + sub;
     HttpUtil.DoHttpMethod("POST", uri, credential, null, false);
 }
Пример #5
0
 public static void PutConfigValue(string uri, string key, string value, NetworkCredential credential)
 {
     uri = uri + "?key=" + key;
     HttpUtil.DoHttpMethod("PUT", uri, credential, value, false);
 }