Javascript 将WebMethod值传递到.aspx页面
项目1:(我从这里发送成员代码“10002”),点击按钮Javascript 将WebMethod值传递到.aspx页面,javascript,asp.net,webmethod,Javascript,Asp.net,Webmethod,项目1:(我从这里发送成员代码“10002”),点击按钮 protected void lnkRFQ_Click(object sender, EventArgs e) { dynamic strReturn = null; var _input = new { CLIENT_ID = txtMember.Text != null ? txtMember.Text : "", }; var result = new { input = _input }
protected void lnkRFQ_Click(object sender, EventArgs e)
{
dynamic strReturn = null;
var _input = new { CLIENT_ID = txtMember.Text != null ? txtMember.Text : "", };
var result = new { input = _input };
string inputJson = (new JavaScriptSerializer()).Serialize(result);
HttpContent inputContent = new StringContent(inputJson, Encoding.UTF8,"application/json");
HttpResponseMessage response = client.PostAsync("http://localhost:52211/test.aspx/SetSession", inputContent).Result;
if (response.IsSuccessStatusCode)
{ strReturn = response.Content.ReadAsStringAsync().Result; }
else
{ string result1 = ("Product" + response.Content.ReadAsStringAsync().Result); }
}
项目2:(我收到的是Web方法中的成员代码“10002”)并存储在会话中
[WebMethod(EnableSession = true)]
public static dynamic SetSession(dynamic input)
{
var MemberCode = input["CLIENT_ID"]; Page objp = new Page();
objp.Session["strDwnPath"] = MemberCode;
string sessinp = objp.Session["strDwnPath"].ToString();
return input;
}
我的问题是,在我接收到这里之后,如何在JavaScript函数中传递这个会话或值