将cUrl翻译为restsharp

时间:2016-02-02 09:55:46

标签: c# asp.net curl restsharp

我有一个cUrl请求:

SELECT u.id AS userId,
        u.type AS userType 
FROM User AS u
INNER JOIN Personal AS p
ON u.id = p.userId
WHERE p.realName LIKE '%adf%' 
AND u.type = 1 
UNION
SELECT u.id AS userId,
        u.type AS userType 
FROM User AS u
INNER JOIN Company AS c 
ON u.id=c.userId
WHERE c.name LIKE '%grge%' 
LIMIT 0 , 10000

我需要像上面那样提出请求,但是使用C#
我的代码示例:

curl -v -u admin:geoserver -XPUT -H "Content-type: application/zip" --data-binary @C:\nyc_khr.zip  http://localhost:9090/geoserver/rest/workspaces/nyc_roads/datastores/roads/file.shp

1 个答案:

答案 0 :(得分:1)

而不是

request.AddFile()

这对我有用:

request.Parameters.Clear();
request.AddParameter("application/zip", data, ParameterType.RequestBody);