Search code examples
asp.net-core-webapi

Why is my controller being called twice from an email link


Been struggling with this for hours.

This is a asp.net core 3.0 app.

It emails an activation link. I then pick up that email in my inbox and click on it.
This link is:

https://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.myserver.com%2FAccount%2FActivate%3Fpin%3DwDiC3S&data=02%7C01%7C%7C8311079d8b314d288f7a08d77e73c924%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637116908072496731&sdata=y80XhRTBI%2FOJq6UrN8Yw%2B3nWDjrb96IprWR2IKIouVU%3D&reserved=0

It then emails me a confirmation message 9#by calling that view). But it does this twice. What is weird is that if I copy and past this url from 1 browser to another I just receive the expected 1 confirmation email.

The only difference I can see is that the safelink stuff add si removed from copying and pasting that link. ie:

https://www.myserver.com/Account/Activate?pin=wDiC3S

I do not know how to debug this?


Solution

  • I have just come across this situation. It has taken me a few days to track down. I have a link within an outlook message and I wrote code to make sure it was not called twice. This code was activated the first time I called it. Eventually I realised that the email client must be calling it twice. I'm going to have to write a work around.

    I'm glad I found it. It was driving me mad!

    I would consider this to be an outlook bug.