I'm trying to send a base64 image from a View to a Controller.
I have the base64 stored in an input and I get it like this (working fine):
var photoBase64Captured = $('#txtPhotoBase64Captured').val();
Then in my View, I call the Controller and wait for a response:
$.get("@Url.Action("CheckFace", "User")", { base64: photoBase64Captured }, function (data) {
var result = $.parseJSON(data);
if (data != null) {
}
});
When I try to call the Controller, I'm getting the following error in Chrome's console:
Failed to load resource: net::ERR_SPDY_PROTOCOL_ERROR
This is the Controller:
public async Task<ActionResult> CheckFace(string base64)
{
}
Any ideas why this is happening? Is the base64 too long to send to the Controller?
If I send other values to the Controller it works fine, so it is not a problem of the method.
$.get(), because sending (large) data to service should be done usingPOSTrequest, with data in the body of request. Could you provide the code of corresponding controller's method?GETorPOSTcontroller action? Looks like you're exceeding limits ofGETrequest (url length). Try the solution suggested above by @ray withPOSTrequest.