Reputation: 68
I use ASP.NET MVC to upload some files with this code:
$.ajax({
url: "WorkOrder/upload?id="+g.toString()+"&type="+type.toString(),
type:"POST",
data: fileData,
processData: false,
contentType: false,
async: true,
success: function (res) {
if (res=="true"){
showSuccess('succes');
$('#myModal').modal('toggle');
}
}
})
and publish to IIS, and when testing it on chrome I get "not found url".
But when writing directly to same address in address bar it is firing the action in the controller. It is interesting that other computers Chrome (version 54) work but on some computers is not working and I get not found URL 404 (all computers work with same code on IIS).
Upvotes: 3
Views: 845
Reputation: 68
Finally find what is the problem!
if you are sure the path is OK but you got this error, it is possible your file size is more than "Maximum allowed content length" in IIS. In this case you will got this error "not found url".
Upvotes: 2
Reputation: 1493
A guess of what might be the issue:
WorkOrder/upload
is a relative path and dependant on where you are when you make the request. For example if you are on the page localhost/fruit
, the request might be sent to localhost/fruitWorkOrder/upload
, which is resonable to return a 404.
If you make the request with /WorkOrder/upload
or whatever the full path from the domain might be, you should be fine.
Upvotes: 0