/// <summary> /// 初始化 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { //装载配置信息 if (!Config.Instance.IsInitialized) { Config.Instance.Load(); } if (!WxUserWrapper.VerifyUserStatus()) { StringBuilder sb = new StringBuilder(); sb.Append("<meta charset=\"UTF-8\">\r\n"); sb.Append("<style>\r\n"); sb.Append(".wrap{\r\n"); sb.Append("width:100%;\r\n"); sb.Append("line-height: 64px;\r\n"); sb.Append("font-size: 36px;\r\n"); sb.Append("color: #666666;\r\n"); sb.Append("font-family: \"微软雅黑\";\r\n"); sb.Append("display:-moz-box;\r\n"); sb.Append("display:-webkit-box;\r\n"); sb.Append("display:box;\r\n"); sb.Append("-moz-box-pack:center;\r\n"); sb.Append("-webkit-box-pack:center;\r\n"); sb.Append("-o-box-pack:center;\r\n"); sb.Append("box-pack:center;\r\n"); sb.Append("margin-top: 100px;\r\n"); sb.Append("}\r\n"); sb.Append("</style>\r\n"); sb.Append(" <div class=\"wrap\">\r\n"); sb.Append(" <div><img src=\"/img/zhuyi.png\"></div>\r\n"); sb.Append(" <div> 无效的授权,或者没有在微信客户端中打开链接!</div>\r\n"); sb.Append("</div>\r\n"); Response.Write(sb.ToString()); Response.End(); } }
protected void Page_Load(object sender, EventArgs e) { JObject res = new JObject(); string sMode = Request.QueryString["mode"]; if (sMode == null) { sMode = ""; } else { sMode = sMode.Trim(); } if (!WxUserWrapper.VerifyUserStatus()) { _DoError(ref res, -10001001, "Please sign in first!", sMode); } else { if (Request.Files.Count > 0) { string sPath = ""; try { string sExt = zUrl.Type(Request.Files[0].FileName); string sName = zDate.Format(DateTime.Now, DateFormatStyle.Style(true, true, true, true, "", "", "", "")); sName += zString.RadonString(4, RandomStrDictionary.AZ09); sName += "." + sExt; sPath = Server.MapPath("/UploadFiles/" + sName); Request.Files[0].SaveAs(sPath); string url = "/UploadFiles/" + sName; if (IsDroparea(sMode)) { res.Add("path", "/UploadFiles/"); res.Add("filename", sName); } else { res.Add("error", 0); res.Add("url", url); } } catch (Exception ex) { zLogger.Instance.DebugLog(MethodBase.GetCurrentMethod().DeclaringType.FullName, MethodBase.GetCurrentMethod().Name, sPath + "\r\n" + ex.ToString(), ex.StackTrace); _DoError(ref res, -10001002, "Failed to upload the files!", sMode); } } else { _DoError(ref res, -10001003, "The http body is empty!", sMode); } } Response.Write(res.ToString()); }
/// <summary> /// 获取Url参数 /// </summary> /// <param name="key">键值</param> /// <param name="nNum">是否为整数</param> /// <returns>参数值</returns> public static string GetUrlPara(string key, bool nNum = true) { return(WxUserWrapper.GetUrlPara(key, nNum)); }
/// <summary> /// 是否包含特定的Url参数 /// </summary> /// <param name="name">Url参数名</param> /// <returns>是否包含</returns> public static bool IsContainsUrlPara(string name) { return(WxUserWrapper.IsContainsUrlPara(name)); }