DoHttpMethod() public static method

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
return string
Beispiel #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);
        }
Beispiel #2
0
        public static string GetOrInitConfigValue(string napkinServerUri, string devicePath, string key, string defaultValue, NetworkCredential credential)
        {
            string uri          = napkinServerUri + "/config/" + devicePath + "?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);
            }
        }
Beispiel #3
0
 public static void PostConfigNode(string uri, string sub, NetworkCredential credential)
 {
     uri = uri + "?sub=" + sub;
     HttpUtil.DoHttpMethod("POST", uri, credential, null, false);
 }
Beispiel #4
0
 public static void PutConfigValue(string uri, string key, string value, NetworkCredential credential)
 {
     uri = uri + "?key=" + key;
     HttpUtil.DoHttpMethod("PUT", uri, credential, value, false);
 }