GetAccessToken.aspx.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.UI;
  6. using System.Web.UI.WebControls;
  7. namespace LYFZ.WeixinServers
  8. {
  9. public partial class GetAccessToken : System.Web.UI.Page
  10. {
  11. protected void Page_Load(object sender, EventArgs e)
  12. {
  13. string kf_account, kf_psw, app_id;
  14. if ( VerifyParameters(out kf_account, out kf_psw, out app_id) )
  15. {
  16. // 获取指定appid的access token 值;
  17. }
  18. else
  19. {
  20. Response.Write("{\"code\":201, \"msg\":\"参数名不对或参数缺少\"}");
  21. }
  22. }
  23. /// <summary>
  24. ///
  25. /// </summary>
  26. /// <param name="kf_account">客服账号</param>
  27. /// <param name="kf_psw">客服密码</param>
  28. /// <param name="app_id">app对象Id</param>
  29. /// <returns></returns>
  30. public bool VerifyParameters(out string kf_account, out string kf_psw, out string app_id )
  31. {
  32. kf_account = kf_psw = app_id = "";
  33. if ( Request.Form["kf_account"] != null && Request.Form["kf_psw"] != null && Request.Form["app_id"] != null )
  34. {
  35. kf_account = Request.Form["kf_account"];
  36. kf_psw = Request.Form["kf_psw"];
  37. app_id = Request.Form["app_id"];
  38. if ( !string.IsNullOrEmpty(kf_account) && !string.IsNullOrEmpty(kf_psw) && !string.IsNullOrEmpty(app_id) )
  39. return true;
  40. }
  41. return false;
  42. }
  43. }
  44. }