Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7961073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:55:53+00:00 2026-06-04T04:55:53+00:00

I have a handler that returns json public void ProcessRequest (HttpContext context) { HttpResponse

  • 0

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.

  1. Would HttpRequest be the appropriate object to use to make a request to the handler?
  2. Could someone provide a simple example of how to request and consume the json object from another c# class (not javascript)?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T04:55:55+00:00Added an answer on June 4, 2026 at 4:55 am

    Here you have a way to consume a json object from c#

    IList<MyClass> myClassList = null;
    var request = WebRequest.Create(url);
    request.ContentType = "application/json; charset=utf-8";
    
    string json;
    using (var response = request.GetResponse())
    {
        using (var sr = new StreamReader(response.GetResponseStream()))
        {
            json = sr.ReadToEnd();
            var javaScriptSerializer = new JavaScriptSerializer();
            myClassList = javaScriptSerializer.Deserialize<List<MyClass>>(json);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have rest controllers that returns Json response. I have added interceptor which will
I have a Handler class that looks like this: class Handler{ public $group; public
I have been trying to add data from my ajax query that returns json
I have a webservice that returns a json object with a decodes image Link
I have a gateway script that returns JSON back to the client. In the
I have the following json object that is available in my .ashx handler (var
I have a Coldfusion Webservice that returns json data like below: {rows:[{cell:[43,USA,jon,doe,doe@gmail.com,HR],id:43}, {cell:[44,JAPAN,tanaka,yidi,yidi@aol.com,IT],id:44}], page:1,records:2,total:1}
I have a httpservice that returns xml data. <mx:HTTPService id=httpService url=data/Software.xml resultFormat=e4x result=httpResult_handler(event) fault=Alert.show('XML
We have a requirment which requires to have an Handler that is extended from
I have an event handler that needs to determine a type and execute code

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.