We experience the following problem: when we send an email via EXM, links inside the email body doesn't work for some users.
Links inside email body are always converted by default to something like:
http://domainname/sitecore/RedirectUrlPage.aspx?ec_contact_id=xxxx84B137D2037C7D180&ec_message_id=xxxxB4CEAA3FD1A3B&ec_url=%2fthelinkpath
that is obviously done for tracking reasons.
However, some users experience 404 error when navigate the link. The Log always says the following:
ERROR EmailCampaign: Object reference not set to an instance of an object.
Exception: System.NullReferenceException
Message: Object reference not set to an instance of an object.
Source: Sitecore.Analytics
at Sitecore.Analytics.Tracking.StandardSession.InitializePage(ICurrentPageContext currentPageContext, ICurrentPageContext oldPage)
at Sitecore.Analytics.Tracking.StandardSession.Identify(String userName)
at Sitecore.Modules.EmailCampaign.Core.Pipelines.RedirectUrl.IdentifyContact.Process(RedirectUrlPipelineArgs args)
at (Object , Object[] )
at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
at Sitecore.Modules.EmailCampaign.UI.RedirectUrlPage.HandleMessageEvent(ID messageId, ID contactId)
at Sitecore.Modules.EmailCampaign.UI.MessageEventPage.OnLoad(EventArgs e)
The only way to fix this error for the user is to clear his cookies or use another browser or use incognito mode. The user is currently logged out from the website.
Sitecore version 8.0 + EXM
Has anyone faced this problem before?
Indeed, this is because of cookies stored from previous sessions, thanks Tchami.
Sitecore Support answer was the same:
This error occurs when you open multiple mails with multiple contactId's in the same browser.
But they didn't propose any solution except for clearing cookies or using another browser.
However, we don't want to break user experience even for this rarely appeared cases.
So, in order to handle the exception, we have found that the following pipeline processor should be rewritten:
<processor type ="Sitecore.Modules.EmailCampaign.Core.Pipelines.RedirectUrl.IdentifyContact, Sitecore.EmailCampaign" />
You can have a look at the code of custom processor here.