文本在发布到处理程序时被修改 [英] Text being modified when posted to handler

查看:61
本文介绍了文本在发布到处理程序时被修改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

当我什至不确定要用Google做什么的时候,这就是那些奇怪的问题之一!

但是,这是我的问题,我正在使用Rijndael加密来加密数据库中的某些值.我可以将该密文恢复得很好,但随后我需要通过查询字符串将其传递给通用处理程序.

因此,如果数据库记录如下所示:

Hi All,

This is one of those strange questions when I''m not even sure what to google for!

But here''s my problem, I''m using Rijndael encryption to encrypt some values in the database. I can pull back this cipher text fine, but then I need to pass this to a generic handler through the query string.

So if the DB record looks like this:

WLIOrjH/zKAEGNSU6XHaqYoXFLmEZ6Y4KBLjpCQowIxGNfS/btNfn2Je72DT2zm4fIpZSLepR/DwIGdtyUJ+zb+DIkItdYhLwaqvEiX9Y+BuS6F0vAfNj0HV1PR6g6z347QXgN1L2bgL2QrzeySBSQ==



查询字符串将如下所示:



The query string will look like this:

WLIOrjH%2fzKAEGNSU6XHaqYoXFLmEZ6Y4KBLjpCQowIxGNfS%2fbtNfn2Je72DT2zm4fIpZSLepR%2fDwIGdtyUJ+zb+DIkItdYhLwaqvEiX9Y+BuS6F0vAfNj0HV1PR6g6z347QXgN1L2bgL2QrzeySBSQ%3d%3d



请注意如何将"="更改为%3d等.现在,当我将此版本的密文分配给字符串时,它将更改为以下内容:



Notice how the "=" have been change to %3d etc. Now when I assign this version of the cipher text to a string it changes to the following:

WLIOrjH/zKAEGNSU6XHaqYoXFLmEZ6Y4KBLjpCQowIxGNfS/btNfn2Je72DT2zm4fIpZSLepR/DwIGdtyUJ zb DIkItdYhLwaqvEiX9Y BuS6F0vAfNj0HV1PR6g6z347QXgN1L2bgL2QrzeySBSQ==



这次注意,"+"已丢失,并用空格代替.然后,这破坏了我的解密方法,并引发了错误.

我猜我需要做某种形式的编码,但是我不确定要开始.

有什么想法吗?
Phil



This time notice the "+" have been lost and replace by a space. This then breaks me decryption method and an error is thrown.

I''m guessing I need to do some form of encoding but i''m not sure were to start.

Any ideas?
Phil

推荐答案

更多信息,来自本文 http://www.w3schools.com/TAGS/ref_urlencode.asp [ ^ ]表示用空格替换"+".我添加了一个快速的string.replace以将其更改回原来的位置,但是如果有人对它是否足够有任何进一步的信息,那就太好了!

Phil
More info, from this article http://www.w3schools.com/TAGS/ref_urlencode.asp[^] it says that "+" are replaced by spaces. I''ve added a quick string.replace to change these back but if anyone has any further info on if this will be sufficient then that would be great!

Phil


对文本进行编码时,请使用Server.UrlEncode(yourString);同样,Server.UrlDecode(theEncodedString)将需要在另一侧使用.

干杯.
When encoding the text use Server.UrlEncode(yourString); likewise, Server.UrlDecode(theEncodedString) will need to be used on the other side.

Cheers.


这篇关于文本在发布到处理程序时被修改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆