I'm not sure how to handle that, it does seem like it would expect the /foo/default.aspx page to handle the request regardless of the rest of the url. It is a strange url structure, the old urls you are redirecting.
Only thing I can think of to try is to create an actual folder /foo and in that folder put a default.aspx file that has code in it detect the rest of the url and to do a 301 redirect appropriately based on some logic about the rest of the url. I think it could be solved but would take some custom development to create the default.aspx pages for each folder with the needed redirect logic.
Hope it helps,