HttpWebRequese模拟登录网站,返回html显示"签名值不合法",求助!

renmian99 renmian99 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
我用HttpWebRequese模拟登录xiaomi网站,登录不成功返回的HTML中提示"签名值不合法",如下:

<p class="retrieve_pwd">提示</p>
<div class="email_tip">签名值不合法</div>


string url = "https://account.xiaomi.com/pass/serviceLoginAuth2";
string postData = "user=******&pwd=*******";
byte[] byteArray = Encoding.UTF8.GetBytes(postData); // 转化
CookieContainer cc = new CookieContainer();
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url);
webRequest.Accept = "text/html, application/xhtml+xml, */*";
webRequest.Referer = "https://account.xiaomi.com/pass/serviceLogin";

webRequest.UserAgent = "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)";
webRequest.AutomaticDecompression = DecompressionMethods.GZip;
webRequest.CookieContainer = cc;
webRequest.Method = "POST";
webRequest.KeepAlive=true;
webRequest.ContentType = "application/x-www-form-urlencoded";
webRequest.ContentLength = byteArray.Length;
Stream newStream = webRequest.GetRequestStream();
// Send the data.
newStream.Write(byteArray, 0, byteArray.Length); //写入参数
newStream.Close();
HttpWebResponse response = null;
try
{
response = (HttpWebResponse)webRequest.GetResponse();
}
catch (System.Exception ex)
{
Console.WriteLine(ex.Message);

}
if (response != null)
{
StreamReader sr2 = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
string text2 = sr2.ReadToEnd();
}
...全文
评论 7
收藏 已收藏
分享
返回顶部
renmian99
C# 111,130 成员 642,540 内容