How RedirectUrl.aspx Page Works In General
The RedirectUrl.aspx page is a passthrough page for links coming out of messages generated by EXM. When this page is it on the Content Delivery server, it actually processes a pipeline called <redirectUrl>
that will decrypt the query parameters coming out of the message. In these query parameters, include the URL to eventually go to, plus additional information like Contact ID, Message Id, and Contact Identifier.
Additionally, when dealing specifically with the Unsubscribe.aspx page, while the link will look like the RedirectUrl.aspx page out on the email, if the link is to the /sitecore%20modules/Web/EXM/Unsubscribe.aspx
or /sitecore%20modules/Web/EXM/UnsubscribeFromAll.aspx
, this will immediately process the Unsubscribe, remove the user from the associated list (as found in the Message via the Message ID). If the list can't be derived, then the contact is added to the Global Opt Out List. Last but not least, the user is then redirected to the Final Confirmation Page if one has been defined on the Manager Root.
How to Get it to work for your Requirement
It appears you have noticed that the query parameters you seek are available on the RedirectUrl.aspx request and passed through to the Unsubscribe.aspx page. In order to have a custom Unsubscribe page that makes use of those parameters, you will need to add your custom Unsubscribe page to the Carryover Fields in the <redirectUrl>
pipeline.
As shown here, you'll want to add your custom unsubscribe page to the urlPattern of any query string field that you want to be carried over to your unsubscribe page.
This will then allow you to use the Client API as needed.
For information about Unsubscribe in general visit: https://sitecorehacker.com/2018/12/17/managing-the-unsubscribe-part-1
For information about the Client API: https://sitecorehacker.com/2018/12/21/managing-the-unsubscribe-part-5