Click here to Skip to main content
15,884,838 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
C#
[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);



posting is not working,please help me
Posted
Comments
Tejas Vaishnav 1-Mar-14 3:31am    
what error you got.. posting means parsing or any thing else..?
ZurdoDev 1-Mar-14 8:01am    
Why doesn't it work?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900