[WebMethod] [ScriptMethod(ResponseFormat = ResponseFormat.Json)] public string GetJSONString2() { prodoct p = new prodoct(); p.i = 500; p.j = 1000; string str = JsonConvert.SerializeObject(p); return str; }
prodoct p = new prodoct(); p.i = 5; p.j = 10; string data = JsonConvert.SerializeObject(p); WebClient webClient = new WebClient(); //webClient.Headers.Add("Authorization", "Bearer " + accesstoken); webClient.Headers.Add("Content-Type", "application/json"); webClient.Headers.Add("User-Agent", "CreditCard Authorize"); string json = ""; string URI = "http://localhost:57084/CreateWebService/Service.asmx"; json = webClient.UploadString(new Uri(URI + "?GetJSONString2"), "POST", data); var jsonres = JsonConvert.DeserializeObject<prodoct>(json); Stream stream = webClient.OpenRead(json); StreamReader reader=new StreamReader(stream); String request = reader.ReadToEnd(); Response.Write(request);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)