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 9188391
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:59:40+00:00 2026-06-17T19:59:40+00:00

I am using iis and asp.net with c#. I have a JSON string which

  • 0

I am using iis and asp.net with c#.

I have a JSON string which I build using JavaScriptSerializer, with MaxJsonLength set as Int32.MaxValue, now I want to return this using response.write, like this Response.Write(myJsonString), but I am wondering is this the proper way to return it? Are there any problems if the string is very long (may contain huge base 64 encoded bytes too) if it still falls within the int32.maxvalue length, is there any limitation from IIS itself (as in the maximum length I can return)? Or should I write a loop to send the string character by character and flush the response every x number of characters?

As an aside, should I add a UTF8 BOM to the front of the response.write to ensure that I can consume the JSON string properly on the receiver’s end? Are there any implications if the JSON string contains base64 encoded bytes?

  • 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-17T19:59:41+00:00Added an answer on June 17, 2026 at 7:59 pm

    now i want to return this using response.write, like this
    Response.Write(myJsonString), but i am wondering is this the proper
    way to return it?

    Instead of using the JavaScriptSerializer class you might consider using JSON.NET or the built-in DataContractJsonSerializer which both allow you to serialize directly to the output stream:

    var serializer = new JsonSerializer();
    serializer.Serialize(context.Response.Output, objectToSerialize);
    

    This way you don’t need to be loading the entire JSON string in memory.

    are there any problems if the string is very long (may contain huge
    base 64 encoded bytes too) if it still falls within the int32.maxvalue
    length, is there any limitation from iis itself (as in the maximum
    length i can return)

    As far as IIS is concerned, I don’t think there would be problems. But as I mentioned earlier you would be consuming lots of memory on your server if you perform the serialization into a string instead of directly streaming it to the client.

    or should i write a loop to send the string character by character and
    flush the reponse every x number of characters?

    This wouldn’t help much as you still have the entire JSON string in memory.

    as an aside i wanna ask too, should i add a ut8 bom to the front of
    the response.write to ensure that i can consume the json string
    properly on the receiver’s end?

    If you use one of the 2 JSON serializers I mentioned previously and write the resulting JSON directly to the response stream they will take care of adding this character.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a ASP.NET website deployed under IIS uisng virtual directories. I'm using forms
I have an ASP.NET MVC 3 app hosted on IIS. This app is using
I have a WCF service (over a webHttpBinding ) using ASP.NET 4/IIS 8 and
I have a current system using IIS 6 and 7, written in ASP.NET with
I am using IIS/asp.net and have a requirement to have two links side by
I have an ASP.NET application running on IIS 7 and using Windows Authentication. For
I have a ASP.NET 4.0 web forms application (IIS 7) where I am using
iam using c#,asp.net and iis, i want to simulate slow internet connection on my
I'm using ASP.NET MVC to develop a web application, deploying to IIS 7. I've
We have an IIS 7.5 with the following site structure: WebApp (ASP.NET Forms) =

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.