protected void Page_Load(object sender, EventArgs e)
{
string strPost = "client_id=XXXXXXX&client_secret=XXXXXXXXXXXXXXXXX&grant_type=silent&kdt_id=XXXXXXX";
string result = string.Empty;
byte[] buffer = Encoding.UTF8.GetBytes(strPost);
StreamWriter mywriter = null;
HttpWebRequest objrequest = (HttpWebRequest)WebRequest.Create("https://open.youzan.com/oauth/token");
objrequest.Method = "POST";
objrequest.ContentLength = buffer.Length;
objrequest.ContentType = "text/xml";
try
{
mywriter = new StreamWriter(objrequest.GetRequestStream());
mywriter.Write(strPost);
}
catch (Exception)
{
result = "发送文件流失败!";
}
finally
{
mywriter.Close();
}
HttpWebResponse objresponse = (HttpWebResponse)objrequest.GetResponse();
using (StreamReader sr = new StreamReader(objresponse.GetResponseStream()))
{
result = sr.ReadToEnd();
sr.Close();
}
lblPostBack.Text = result;
}
返回提示
{"error_description":"缺少参数grant_type","error":"41000"}
请技术员大神帮忙看一下哪里出错了
本帖最后由 水流千山 于 2018-8-10 22:36 编辑
|