ASP.NET MVC API 接口验证的示例代码(4)

/// <summary> /// 测试留言接口调用 /// </summary> /// <returns></returns> public ActionResult AddCustomerMessage() { string url = "http://192.168.1.88:808/api/CustomerMessage/Add?"; WebClient webClient = new WebClient(); NameValueCollection postValues = new NameValueCollection(); postValues.Add("Message", "填写您的留言内容吧"); postValues.Add("SendEmail", "youemail@qq.com"); postValues.Add("SendTelephone", "021-60375335"); postValues.Add("Code", "661137858"); postValues.Add("AppKey", "wssavbcn"); postValues.Add("AppSecret", "350e66b1e6564b0a817163erwwwwe8"); postValues.Add("SystemFrom", "官网"); byte[] responseArray = webClient.UploadValues(url, postValues); string response = Encoding.UTF8.GetString(responseArray); return Content(response); }

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wdpwdw.html