I am posting to a file using ajax in DNN 7.1. The .ashx is on the site root outside of the portals directory. The response is a 404 error and the URL is rewritten to ...com/cart/undefined. I can however put in the following www.mysite.com/cart/cart.ashx and get the expected response.
This started by trying to use a .ashx file to call an API. Same code on another site returns 400 with a detailed error message. On the current site the file returns 400 BadRequest and nothing else.
Finally resolved this issue:
Response.TrySkipIisCustomErrors = true;