I am trying to call a json webmethod (present in the code behind file) from browser. But get no output!
In my json.aspx.cs page: the web method is
[System.Web.Script.Services.ScriptService]
public class _default : System.Web.Services.WebService
{
[WebMethod]
[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
public string[] UserDetails()
{
return new string[] { "abc", "def" };
}
}
When I try the following url from browser:
http://www.mydomain/json.aspx/UserDetails
I get no result! (The page is blank) I expect - the browser to show - { "abc", "def" }
Correct me if I am doing something wrong. My intention is to get the result as plain text in browser. Is it not possible to achieve if I place the webmethod in the code behind? I don't want to create a separate service for this...