Link to home
Start Free TrialLog in
Avatar of ITsolutionWizard
ITsolutionWizardFlag for United States of America

asked on

mvc data size acception

i have the following codes, and everything is working except the outhtml's size is too big but i do not know how big.
so I added some settings on webconfig but it is till not working.
Can you share with me whatelse I need to do to max the size of accepting data size?
[HttpPost]
        public JsonResult GetAgingReport(string invoicestartandenddate, string receiptstartandenddate, string chargecode)
        {
             
            Domain.Accounting.Report r = new Domain.Accounting.Report();             
            r.invoicestartdate = invoicestartdate;
            r.invoiceendate = invoiceenddate;
            r.receiptstartdate = receiptstartdate;
            r.receiptenddate = receiptenddate;
            r.chargecode = chargecode;
    
            MasterController.ServiceAccounting sa = new MasterController.ServiceAccounting();
            List<Domain.Accounting.Report> agingInDetail= sa.AgingInDetails(r);
            string returnStrInHTML = sa.AgingInDetailsInHTML(agingInDetail);
       
             r.outputHTML = returnStrInHTML;
            return Json(r, JsonRequestBehavior.AllowGet);
        }

Open in new window

  $.ajax({
                url: "/Accounting/GetAgingReport",
                datatype: "text",
                data:
                {
                    'invoicestartandenddate': invoicestartandenddatevalue,
                    'receiptstartandenddate': depositstartandenddatevalue,                   
                    'chargecode': chargecodevalue
                },
                type: "POST",
                success: function (data) {
                    var id = data.outputHTML;
                    alert("Success");
                         
                },
                error: function (error) {
                    alert("Error " + error);

                }
            }); 

Open in new window

 <system.web>
    <customErrors mode="Off"/>
    <compilation debug="true" targetFramework="4.6.1"/>
    <httpRuntime targetFramework="4.6.1" executionTimeout="100000" maxRequestLength="214748364" />
  </system.web>
  <system.web.extensions>
    <scripting>
      <webServices>
        <jsonSerialization maxJsonLength="2147483647" />
      </webServices>
    </scripting>
  </system.web.extensions>
  <system.webServer>
     <security>
      <requestFiltering>
        <requestLimits  maxAllowedContentLength="2147483647"  />
      </requestFiltering>
    </security>
  </system.webServer>

Open in new window

Avatar of ITsolutionWizard
ITsolutionWizard
Flag of United States of America image

ASKER

anyone can help?
any one here ?
Avatar of Chinmay Patel
What is the maximum size you are trying to post? any approximation?
I don't the size. just tell me what else I need to do on the setting
any helps?
any helps?
Are you getting any errors when you try to upload the file? If yes, please paste the error content here, you can remove any sensitive information from the error.
not upload it is Json response
Did you try to debug it on server side? Or it fails before you hit the breakpoint? What do you get in JsonResponse?
all i see object object alert in js.
But that would mean
The call was successful. If there was an error you would see alert("Error " + error);
                    var id = data.outputHTML;
                    alert("Success");
 

Open in new window


Also you have set the size to 2147483647, any specific reason/calculations behind this number?
Also 214748364 would mean size of 2GB, which I think is way too high for a Report. Maybe you need to tweak this number as well.

As long as you are not getting an error, I suggest you look in to your server side code why it is not able to process the message.
i did review the source code behind.and I actually put the exact same codes on aspx / c# page, and it is working and without any errors regardless of any sizes.
Did you change the web.config's 2147483647 value to 214748364 or even that was not needed?
I post the web config codes already when i post this question.

 <system.web>
    <customErrors mode="Off"/>
    <compilation debug="true" targetFramework="4.6.1"/>
    <httpRuntime targetFramework="4.6.1" executionTimeout="100000" maxRequestLength="214748364" />
  </system.web>
  <system.web.extensions>
    <scripting>
      <webServices>
        <jsonSerialization maxJsonLength="2147483647" />
      </webServices>
    </scripting>
  </system.web.extensions>
  <system.webServer>
     <security>
      <requestFiltering>
        <requestLimits  maxAllowedContentLength="2147483647"  />
      </requestFiltering>
    </security>
  </system.webServer>

Open in new window

I know you posted web.config, I just wanted to check if you changed the values or not. It seems you did not.

When you run the page and upload a large file, do you see an alert with "Success" in it?

Also can you check what are you getting from the server side method by putting a debugger and watching the value of data in browser console?
success: function (data) {
debugger;
                    var id = data.outputHTML;
                    alert("Success");
                },

Open in new window

I change the number and add debugger there.
The response is no change.
any progress?
debugger is used on client side script to check if it stops, have you tried debugging the JavaScript using Developer Tools of the browser?

Also do you see any alert message?
hi chinmay, i am not sure you refer to.
ASKER CERTIFIED SOLUTION
Avatar of Chinmay Patel
Chinmay Patel
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial