Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/258.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
c#-使用Httpwebrequest复制cURL调用_C#_Curl_Httpwebrequest - Fatal编程技术网

c#-使用Httpwebrequest复制cURL调用

c#-使用Httpwebrequest复制cURL调用,c#,curl,httpwebrequest,C#,Curl,Httpwebrequest,我读过关于这个话题的其他问题,但它们与我的情况不符。 这是我要翻译的cURL调用: curl -u "{username}":"{password}" -F data=@data.csv -F metadata="{\"language\":\"en\",\"name\":\"Title\"}" "https://example.com" 我知道如何为请求的url设置凭据和方法,但我不知道如何前进。它们似乎是两个文件:csv第一个,json第二个 HttpW

我读过关于这个话题的其他问题,但它们与我的情况不符。 这是我要翻译的cURL调用:

curl -u "{username}":"{password}"   
     -F data=@data.csv
     -F metadata="{\"language\":\"en\",\"name\":\"Title\"}"
     "https://example.com"
我知道如何为请求的url设置凭据和方法,但我不知道如何前进。它们似乎是两个文件:csv第一个,json第二个

HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://example.com");
request.Method = "POST";                
request.Credentials = new NetworkCredential("username", "password");