0

I have used the code from this answer Android services with RestFull web services

but when I try to call like this,

json = restClientService.getResponseAsJSON("http://192.168.2.242/Test.aspx/Hello", params);

my asp.net web pages webmethod doesn't get fired. I added Page_Load code looks working but I want to be able to call WebMethods rather then page itself.

public partial class Test : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Write(new { Hi = "Mr" });
        Response.End();
    }

    [WebMethod]
    [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
    public object Hello()
    {
        return new { Hi = "Mr" };
    }
}
Community
  • 1
  • 1
Mert
  • 6,432
  • 6
  • 32
  • 68

0 Answers0