0

In AngularJs, when I send three rows of data to the server, it sends successfully, but if more than three then it throws an error in console. error image is attached.

$http({
                    url: '/scrap/CSVCreator',
                    method: "GET",
                    params: { CSVdata: $scope.CSVfileData }
                }).then(
                    function successCallback(response) {
                        var hiddenElement = document.createElement('a');
                        hiddenElement.href = "/scrap/GetCSV";
                        hiddenElement.click();

                        $scope.loading = false;
                    },
                    function errorCallback(response) {
                        $scope.loading = false;
                        $scope.validationmessage(response.data);
                        return;
                    });

enter image description here

Daniel
  • 3,541
  • 3
  • 33
  • 46
  • 2
    I think you should use POST to send large data as GET request has limited URL length. – Sushant Yadav Jun 09 '17 at 19:14
  • [URL length has limits.](https://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers) Can you say what is the length of the URL in your case, when more than 3 rows are selected? – Stanislav Kvitash Jun 09 '17 at 19:18
  • Seconding @SushantYadav here. You are generating a resource from a large set of data, which is more fitting for a POST request. – VivaLaPanda Jun 09 '17 at 20:00
  • I have tried post also. same problem. the length of the row is in hundreds or can be more – Nafiis Mushtaq Jun 09 '17 at 21:29

1 Answers1

1
<system.web>
      <httpRuntime targetFramework="4.5.2" maxQueryStringLength = "1200000" maxUrlLength="1200000" />
</system.web>

And also add

<system.webServer>
        <security>
            <requestFiltering>
              <requestLimits maxQueryString="1200000"/>
            </requestFiltering>
        </security>
  </system.webServer>