智学无忧的教学系统打算开发微信版本,目的是利用微信的方便,为智学无忧的同窗提供更加的遍历服务。开发第一步遇到坑了,拿出来和你们分享,但愿对网友有帮助服务器
1. 微信公众号要认证,咱们的已是认证的了微信
2.进入服务器配置(这个地方有坑)网站
查了各类资料,才知道,这个地方是随意填的,核心的目的就是验证这个网站或服务器是有效的而已。微信根据上面提供的地址,发送一个get请求。请求的信息为spa
echoStr 、signature、timestamp、noncecode
其实就是返回echoStr 便可,其它的参数不用理会。主要目的就是验证这个服务器是否有效。blog
个人后台语言是C#的,因此贴上个人代码 token
public partial class Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string token = "zxwyit";
if (string.IsNullOrEmpty(token))
{
return;
}
string echoString = HttpContext.Current.Request.QueryString["echoStr"];
string signature = HttpContext.Current.Request.QueryString["signature"];
string timestamp = HttpContext.Current.Request.QueryString["timestamp"];
string nonce = HttpContext.Current.Request.QueryString["nonce"];
if (!string.IsNullOrEmpty(echoString))
{
HttpContext.Current.Response.Write(echoString);
HttpContext.Current.Response.End();
}
}
}
验证经过后,进入网站的首页就能够换掉了。开发
最简洁的代码get
public partial class Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string echoString = HttpContext.Current.Request.QueryString["echoStr"];
Response.Write(echoString);
}
}