1. 程式人生 > >C# 如何發送Http請求

C# 如何發送Http請求

quest string uget class nuget bin ken pos ict

HttpSender是一個用來發送Http消息的輕量庫,使用非常簡單

使用 Nuget,搜索 HttpSender 就能找到

命名空間是HttpSender,類名是Sender

方法如下

發送 Get 請求

static string Get(string url)

發送 Post 請求

static string Post(string url,string content)
static string Post(string url, Dictionary<string,string> content)

發送 Put 請求

static string Put(string url)
static string Put(string url, Dictionary<string,string> content)

發送 Delete 請求

static string Delete(string url)

在Http頭部中設置 OAuth 令牌

static void OAuth(string token)

C# 如何發送Http請求