简体   繁体   English

如何防止Windows Live Mail中的编码正斜杠解码?

[英]How to prevent decoding of encoded forward slashes in Windows Live mail?

I've got aform with a continue link that is send by email. 我有一个包含通过电子邮件发送的继续链接的表格。 In this link I've added some sensitive encrypted data that is encoded by Base64 . 在此链接中,我添加了一些由Base64编码的敏感加密数据。 The value contains a slash which is encoded into %2F (with a Server.UrlEncode ). 该值包含一个斜杠,该斜杠被编码为%2F (带有Server.UrlEncode )。 When I send the link to a Windows Live address I see that Outlook.com decodes the %2F back into a forward slash. 当我将链接发送到Windows Live地址时,我看到Outlook.com将%2F解码回正斜杠。 How can I prevent this? 我该如何预防?

I'm sending: 我正在发送:
<a href="http://www.tempuri.com/key=RVQ%2FcGhvbmVfaG9tZSE%3D">Continue</a>

But I'm seeing: 但是我看到了:
<a href="http://www.tempuri.com/key=RVQ/cGhvbmVfaG9tZSE=%3D">Continue</a>

It can be reproduced by sending the link http://www.tempuri.com/key=RVQ%2FcGhvbmVfaG9tZSE%3D from any mail client to the Windows Live address. 可以通过从任何邮件客户端向Windows Live地址发送链接http://www.tempuri.com/key=RVQ%2FcGhvbmVfaG9tZSE%3D来复制该链接。

You can try to encode the value twice. 您可以尝试对值进行两次编码。

So RVQ/cGhvbmVfaG9tZSE= is encoded as RVQ%2FcGhvbmVfaG9tZSE%3D --> this was your value. 因此RVQ/cGhvbmVfaG9tZSE=编码为RVQ%2FcGhvbmVfaG9tZSE%3D >这就是您的价值。

Now encode this, and you get RVQ%252FcGhvbmVfaG9tZSE%253D --> the email client won't decode %252F to a slash so your problem is gone. 现在对此进行编码,您将得到RVQ%252FcGhvbmVfaG9tZSE%253D >电子邮件客户端不会将%252F解码为斜线,因此您的问题就解决了。

Just don't forget to decode the value twice ;-) 只是不要忘记将值解码两次;-)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM