To develop a micro-credit, you need to have a server first, but not yourself. At this time can use peanut shells, the intranet map to the public online, so you can access their website in the public network. Specific See: http://www.jb51.net/article/83783.htm
Then write an access code, and only PHP is the sample on the micro-letter. Here is an example of asp.net.
first create a default.aspx. Check in the Page_Load : (MyLog is a log class, can be ignored) about Checksignature () and found that almost. Here, post it.
Mylog.debuginfo ("request Default.aspx");
String echostr = request.querystring["Echostr"];
Mylog.debuginfo ("Echostr:" +echostr);
if (This.checksignature ())
{
if (!string). IsNullOrEmpty (ECHOSTR)) {
mylog.debuginfo ("echostr:" + echostr);
Response.Write (ECHOSTR);
Response.End ();
}
The most important thing is the sentence response.end (), do not add this sentence how not to go in (wish to have great God to inform). About Checksignature () is about the same as what was found. Here, post it.
private bool Checksignature () {String signature = request["signature"];
string timestamp = request["timestamp"];
String nonce = request["nonce"];
Mylog.debuginfo (String.Format ("signature:{0},timestamp:{1},nonce:{2}", signature, timestamp, nonce));
string token = token;
string[] Tmparr = new string[] {token, timestamp, nonce};
Array.Sort (Tmparr); String tmpstr = String.
Join ("", Tmparr);
SHA1 encryption System.Security.Cryptography.SHA1 SHA1 = new System.Security.Cryptography.SHA1CryptoServiceProvider ();
byte[] Secarr = Sha1.computehash (System.Text.Encoding.Default.GetBytes (TMPSTR)); Tmpstr = bitconverter.tostring (Secarr). Replace ("-", "").
ToLower ();
Mylog.debuginfo (String.Format ("After parse:{0}", Tmpstr));
if (tmpstr = = signature) {Mylog.debuginfo ("true");
return true;
else {return false; }
}
This is mainly because of the response.end () problem, which led me to a long time, I hereby record the hope to help people who can help.
There is also a point may be due to the micro-mail server token validation failure, more than 2 times, do not like me to only click once Ah!!!