码迷,mamicode.com
首页 > Web开发 > 详细

jquery ajax 访问aspx

时间:2016-06-12 12:24:18      阅读:169      评论:0      收藏:0      [点我收藏+]

标签:

<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);
            }
        }

  

jquery ajax 访问aspx

标签:

原文地址:http://www.cnblogs.com/caohuimingfa/p/5577014.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!