As I am developing a web application in ASP.NET Core 3.1 and I am passing large form data using ajax into my controller and it is always null.
If I decrease the amount of data, then it works fine, but with large amounts of data, it's always null.
Below links already tried
Increase upload file size in Asp.Net core
New default 30 MB (~28.6 MiB) max request body size limit
This is my Ajax call
publicObject.PostRequest = function (url, data, onSuccess, onError, _withoutLoader) {
$.ajax({
url: _url,
type: "POST",
headers: {
'RequestVerificationToken': $('input:hidden[name="__RequestVerificationToken"]').val()
},
cache: false,
data: _data,
success: function (_data) {
//CFD.Loader.hide();
_onSuccess(_data);
},
error: function (result, textStatus, _xhr) {
CFD.Loader.hide();
if (_result.status == 401) {
CFD.User.GetLoginModal('loginsection');
}
_onError(_result);
}
});
};
Here is my controller action method:
[HttpPost]
[RequestFormLimits(MultipartBodyLengthLimit = int.MaxValue)]
[RequestSizeLimit( int.MaxValue)]
public async Task<IActionResult> GetProducts(VMProductFilter model)
{
List<VMProduct> resultModel = null;
try
{
resultModel = await GetAllProducts(model);
}
catch (Exception ex)
{
ex.Log();
}
return PartialView("_ProductGrid", resultModel);
}
Thanks In advance