设定获取模式:
context.Response.ContentType = "text/plain";
获取IP地址:
string IpAdd = context.Request.ServerVariables.Get("Remote_Addr").ToString();
获取传入的参数:
context.Request["cashu"]=context.Request.form["canshu"]
传出应答数据局:
context.Response.Write(JsonConvert.SerializeObject(msg));
Ajax的获取方式:
$.ajax({
type: "get",
contentType: "application/json;charset=utf-8",
url: "/TransUrl.ashx",
data: { VoteNo: VoteNo, PlayerId: PlayerId, ActivityId: ActivityId },
dataType: "json",
success: function(OutData) {
console.log(OutData);//获取域名正在使用的
if (OutData.Result == 200) {
var HrefUrl = OutData.DomainInfo;
console.log(HrefUrl);
window.location.href =HrefUrl;
} else
{
window.location.href = "Error.html";//跳转到错误页面
}
},
error: function () {
console.log(OutData);
}
});