If possible, you need to make your sessionId URL secure. SessionId is encoded by Base64, and in Base64 there are three characters of the error problem, "/", "+" and "=". To encode your sessionId when creating a link, use the following command:
public string ToUrlSafeBase64String(string Base64String) { // avoid any slashes, plus signs or equal signs // the following makes this base64 string url safe Base64String = Base64String.Replace("/", "_"); Base64String = Base64String.Replace("+", "-"); return Base64String.Replace("=", String.Empty); }
Then, to recreate the original Base64 encoded string, use the following:
public string FromUrlSafeBase64String(string Base64String) { // add back any slashes, plus signs or equal signs // the following makes this url safe string a base64 string Base64String = Base64String.Replace("_", "/"); Base64String = Base64String.Replace( "-", "+"); return Base64String.PadRight(Base64String.Length + (4 - Base64String.Length % 4) % 4, '='); }
source share