I've found several solutions for this on the web that are for WCF web service and not ASP web service.
Currently, I'm getting back a JSON response that says:
{"d":[{"__type":"NetworkFuzzWebSvc.Sessions","BaseUri":"http://localbox","SessionId":"43b8716f-40ab-43bf-8311-575c2ecd2730}]}
I need it to return:
{"Sessions":["BaseUri":"http://localbox","SessionId":"43b8716f-40ab-43bf-8311-575c2ecd2730}]}
Here is a copy of the webservice code that I'm using (NetFuzzWebSvc.asmx):
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.Services;
using System.Web.Script.Services;
namespace NetworkFuzzWebSvc
{
public class Sessions
{
public string BaseUri;
public string SessionId;
}
/// <summary>
/// Summary description for NetFuzzJson
/// </summary>
[WebService(Namespace = "http://localbox")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ScriptService]
public class NetFuzzJson : WebService
{
List<Sessions> Sessions = new List<Sessions>
{
new Sessions{
BaseUri = "http://localbox/",
SessionId="43b8716f-40ab-43bf-8311-575c2ecd2730"
}
};
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public List<Sessions> GetAllSessions()
{
return Sessions;
}
}
Anyone have a solution to this? Thanks!