标签:
<script type="text/javascript"> function btnTest_click() { $.ajax({ type: "POST", url: "authentication", //contentType: "application/text", dataType: "text", data: {k:‘cUw0K3VBLy81dCtlUVdVZlF6dzVPZkVWeUdhUVE5US9OMkdQNWlTdWMza1dCZzN2RDZDS0VPdmk2Tnl3SHIyb2VLZjd1cEx1eitqZFVZV0MzbFNKRUVhaGxwMUtJZG9ZaU1hVkZmaXNIQjA9‘}, success: function (result) { alert("1"); alert(result.d); }, error: function () { alert("访问失败!"); } }); //$.post("authentication", { k: ‘cUw0K3VBLy81dCtlUVdVZlF6dzVPZkVWeUdhUVE5US9OMkdQNWlTdWMza1dCZzN2RDZDS0VPdmk2Tnl3SHIyb2VLZjd1cEx1eitqZFVZV0MzbFNKRUVhaGxwMUtJZG9ZaU1hVkZmaXNIQjA9‘ }, // function (data) { // alert(data); // }, // "text"); } </script>
protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { if (Request.Form["k"] == null) { Response.Write("fail"); return; } string strK = Request.Form["k"]; byte[] bytes = Convert.FromBase64String(strK); string strEInput = System.Text.Encoding.UTF8.GetString(bytes); WebTools.Encode.GetPass gp = new WebTools.Encode.GetPass(); string strDInput = gp.DecodePass(strEInput); string[] arryPar = strDInput.Split(‘;‘); string strUserNameInfo = arryPar[0]; string strKeTangIdInfo = arryPar[1]; string strTsTimeInfo = arryPar[2]; //验证用户是否登录 EditorAuth ea = new EditorAuth(); bool bIsLogin = ea.CheckUserIsLogined(); if (!bIsLogin) { Response.Write("fail"); return; } //验证课堂ID是否有效,并且已经购买过 string zhibo_ketangId = System.Configuration.ConfigurationManager.AppSettings["zhibo_ketangId"]; string[] arryKetangId = strKeTangIdInfo.Split(‘:‘); string strKeTangId = arryKetangId[1]; if (zhibo_ketangId != strKeTangId) { Response.Write("fail"); return; } string zhibo_isBuy = System.Configuration.ConfigurationManager.AppSettings["zhibo_isBuy"]; if (zhibo_isBuy != "1") { Response.Write("fail"); return; } Response.Write("pass"); //return Content("fail"); } } catch (Exception ex) { Response.Write(ex.Message); } }
标签:
原文地址:http://www.cnblogs.com/caohuimingfa/p/5577014.html