The return URL for securepage.aspx is normally stored in a context parameter when you redirect for login. In both the ACS hosted login page, and the custom downloadable one, there is javascript that queries ACS for the identity provider list, and then generates the login links for each IP. The ACS hosted version is special in that it will also collect the wctx given to it and customize each IP login url to preserve this context. This way ACS knows where to redirect the user back to when authentication is complete.
The custom downloadable login page however doesn't preserve this context, which is why you get this behavior, ACS simply redirects you to the Return URL you specified in your ACS configuration, in this case default.aspx.
But you can change your custom login page to insert this missing parameter. The complication here is that this context is communicated differently depending on the protocol. For LiveID (WS-Federation) the incoming wctx can be re-transmitted in the outgoing wctx in the liveID login link, but in a boxed form "cx". Below is some javascript I added to the CreateIdentityProviderButton() function that achieves this.
...
//Creates a stylized link to an identity provider's login page
function CreateIdentityProviderButton(identityProvider) {
// Some code I stole from fellow stackoverflow member for extracting query parameters =)
var urlParams = {};
(function () {
var e,
a = /\+/g, // Regex for replacing addition symbol with a space
r = /([^&=]+)=?([^&]*)/g,
d = function (s) { return decodeURIComponent(s.replace(a, " ")); },
q = window.location.search.substring(1);
while (e = r.exec(q))
urlParams[d(e[1])] = d(e[2]);
})();
var cx = "&cx=" + encodeURIComponent(urlParams.wctx);
var idpList = document.getElementById("IdentityProvidersList");
var button = document.createElement("button");
button.setAttribute("name", identityProvider.Name);
button.setAttribute("id", identityProvider.LoginUrl + encodeURIComponent(cx));
...
For Yahoo or Google (OpenID) this context is returned in openid.return_to, as a "context" query parameter. So in your login page you could similarly edit the openid.return_to in your login link like so:
... openid.return_to=https://youracstenant.accesscontrol.windows.net:443/v2/openid?context=<value of the wctx extracted from javascript above> ...
You could write code to special case your login link based on what identity provider name you see in the ACS IdentityProvider.js json response.