c# - httppost to asp net handler -
i wish pass object data asp.net handler aspx.cs , cross on project. comment appreciated.
//project (abc.aspx.cs) try { string ltq_str = new javascriptserializer().serialize(ltq); int t = -1; string result = gnuse.httpsend("http://localhost/is/tqueuedtcscontroller/integrationservice?tqueuedtcslist", httputility.urlencode(ltq_str), ref t, "get"); if (!result.equals("success")) { grn.delete(convert.toint32(hfid.value), false); lblerror.text = "inventory integration failed: " + result; } }
for project b (tqueuedtcscontroller.cs)
public actionresult integrationservice(string tqueuedtcslist) { try { list<tqueuedtcintegration> listoftqueuedtc = jsonconvert.deserializeobject<list<tqueuedtcintegration>>(tqueuedtcslist); // string[] value_arr = tqueuedtc.productname.split(new char[] { '-' }); if (listoftqueuedtc.count() <=0) { return content("list empty", "application/text"); } foreach (tqueuedtcintegration tqueuedtcint in listoftqueuedtc) { //performed thing } }
even question after friend me solve problem, provide solution question hope can someone.
try { string ltq_str = new javascriptserializer().serialize(ltq); int t = -1; string result = gnuse.httpsend("http://localhost/is/tqueuedtcs/integrationservice?tqueuedtcslist=", httputility.urlencode(ltq_str), ref t, "get"); if (!result.equals("success")) { grn.delete(convert.toint32(hfid.value), false); lblerror.text = "inventory integration failed: " + result; } } catch (exception e) { e.message.tostring(); }
the 1st changes : tqueuedtcscontroller >> tqueuedtcs because cannot directly point .cs file contain function should point page using function.
the 2nd changes : add ‘=’ passing object or value.
Comments
Post a Comment