This is a very similar question to this aspnet identity invalid token on confirmation email but the solutions are not valid because I am using the new ASP.NET Core 1.0 that
I have tried the answers above, but this guide has helped me. Basically, you would need to encode the code, otherwise, you would encounter some weird bugs. To summarise you would need to do this:
string code = HttpUtility.UrlEncode(UserManager.GenerateEmailConfirmationToken(userID));
After this, if it is applicable to you, decode code:
string decoded = HttpUtility.UrlDecode(code)