I have a handler that returns json
public void ProcessRequest (HttpContext context) {
HttpResponse response = context.Response;
response.ContentType = "application/json";
string controlType = context.Request.QueryString["controlType"];
JavaScriptSerializer jsonSerializer = new JavaScriptSerializer();
CmsManager cmsManager = new CmsManager();
IDictionary<string, Guid> sitefinityPageDictionary = SitefinityUtilities.sitefinityPageDictionary;
if (string.IsNullOrEmpty(controlType)) {
response.Write("0");
}
else {
var pagesWithControl = from page in sitefinityPageDictionary
from control in cmsManager.GetPage(page.Value).Controls
where control.TypeName == controlType
select page;
response.Write(jsonSerializer.Serialize(pagesWithControl));
}
}
In a seperate project I would like to make a request to the handler to consume the json object returned.
- Would
HttpRequestbe the appropriate object to use to make a request to the handler? - Could someone provide a simple example of how to request and consume the json object from another c# class (not javascript)?
Here you have a way to consume a json object from c#