Re如何得到signatrue
nocerStr就是你自己随机生成8位数的字符串
/// <summary>
/// 返回一个八位的随机号,用于签名
/// </summary>
/// <returns></returns>
public static string randNonce()
{
var result = "";
var random = new Random((int)DateTime.Now.Ticks);
const string textArray = "123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
for (var i = 0; i < 8; i++)
{
result = result + textArray.Substring(random.Next() % textArray.Length, 1);
}
return result;
}
c#版本的签名:
string1 = string.Format(string1, jsApiTicket, nonceStr, timestamp, url);
signature = FormsAuthentication.HashPasswordForStoringInConfigFile(string1, "SHA1").ToLower();
就是你把整个字符串变成hash码 啊