i'm working on website, trying call function c# dll through default.asmx.cs
it works fine .net version 3.5, our production site .net 2.0
i'm using simple ajax request call method in default.asmx
, there dll. found can not use [webmethod] in net2, other way work around this?
//this handler public partial class _default : system.web.ui.page { protected void page_load(object sender, eventargs e) { } [system.web.services.webmethod] public static string removeautorecharge(string custserviceid) { class1 jp = new class1(); return jp.removecustomerautorecharge(custserviceid); } }
//ajax call:
$.ajax({ type: "post", url:"default.asnx/removeautorecharge", data: "{custid:123}", contenttype: "application/json; charset=utf-8", datatype: "json", complete:function (xhr, status) { alert(xhr.responsetext); alert(xhr.status); }, success: function(result) { $('#automsg').html(result.d); }, error: function(xmlhttprequest, status, err) { $('#automsg').html("error!") } });
do have source code dll? [webmethod] works in .net 2. perhaps can modify project created binary, , make .net 2 project.
[webmethod] public string helloworld() { return "hello world"; }
this ran using .net 2 project:
Comments
Post a Comment