public ActionResult AddMessage() { string sessionCheckCode = Session["CheckCode"] == null ? null : Session["CheckCode"].ToString(); Session["CheckCode"] = null; if (sessionCheckCode == null) { return(Json(new { success = false, msg = "验证码已经过期,请刷新验证码!" })); } Validation vld = new Validation(); string checkCode = vld.Get("checkCode"); if (checkCode.ToLower() != sessionCheckCode.ToLower()) { return(Json(new { success = false, msg = "验证码错误!" })); } int productID = vld.GetInt("productID"); string content = vld.Get("content"); bool isAnonymity = vld.GetBool("isAnonymity"); UserObj user = AppData.SessionUser; ProductBLL productBLL = new ProductBLL(); productBLL.AddMessage(user == null ? Request.UserHostAddress : user.UserName, productID, content, isAnonymity); return(Json(new { success = true })); }