Background information
During dispatch, all links are replaced with a link to /sitecore/RedirectUrlPage.aspx with additional query string parameters such as contact id and message id.
RedirectUrlPage.aspx runs the redirectUrl pipeline, which is responsible for several things, e.g. adding click events based on the query string parameters. After running the pipeline, it will redirect you to the actual link e.g. /sitecore/unsubscribe.aspx.
The link to redirect to is set in the redirectUrl/SetRedirectToUrl pipeline processor.
Now, because some links require the query string parameters, those query string parameters needs to be passed along from RedirectUrlPage.aspx to the next page. The redirectUrl/SetRedirectToUrl pipeline processor does this using the internalCarryoverFields configuration of the processor, e.g.:
<internalCarryoverFields hint="list:AddInternalCarryoverField">
<carryoverField type="Sitecore.EmailCampaign.Cd.Pipelines.RedirectUrl.CarryoverField, Sitecore.EmailCampaign.Cd">
<param desc="fieldKey" value="mid" />
<param desc="urlPattern">.*Unsubscribe.aspx</param>
</carryoverField>
</internalCarryoverFields>
The fieldKey being the query string parameter, and the urlPattern the url pattern where the fieldKey should be passed to.
In this case we're telling that the query string parameter "mid" should be passed on to any internal urls matching the .*Unsubscribe.aspx pattern.
So, to reiterate:
- Link in email: <a href="http://www.yourdomain.com/Unsubscribe.aspx">Unsubscribe</a>
- Is transformed by EXM into: <a href="http://www.yourdomain.com/RedirectUrlPage.aspx?eq=encryptedquerystring">Unsubscribe</a>
- Contact clicks the link and RedirectUrlPage redirects you to:
http://www.yourdomain.com/Unsubscribe.aspx?mid=value
Problem and solution
The urlPattern matching is case-sensitive, so you need to either change your links to Unsubscribe.aspx (with capital U), or add the lower-case variation to your configuration (Sitecore.EmailExperience.ContentDelivery.config).
This bug is fixed in the next EXM release.
Sitecore.Analytics.Tracker.Current.Contact;
. But if I set it tohttps://www.yoursite.com
then at least my site doesn't throw an error. But the link to the unsubscribe.aspx still throws a 404. – Corey Burnett Feb 28 '17 at 15:41