Forum Discussion

Dinesh_admin's avatar
Dinesh_admin
Copper Contributor
Sep 23, 2025

How to extract domain of the original link from a SafeLink

I'm trying to extract the original domain from the links that are warped by Microsoft SafeLinks I use the Nager.publicsuffix library in C# to parse domains, but with SafeLink's it only returns the SafeLink domain instead of the real one

Example:

https://ind01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstspg.io%2Fn504fyn3g38x...
https://nam.safelink.emails.azure.net/redirect/?destination=https%3A%2F%2Fentra.microsoft.com%2Fdemodomain.cf%23blade...

I've tried writing custom logic for SafeLink pattern, but Microsoft seems to use different formats, so it's not reliable

Question:

What's the best way in C# to reliably detect and unwrap these SafeLink's (or other tracking URLs) so I can extract the original domain before passing it to Nager.PublicSuffix

No RepliesBe the first to reply

Resources