加密查询字符串
我已经使用 MachineKey.Encode 来加密作为查询字符串传递到页面的 ID,但正如预期的那样,这使得 URL 变得巨大。
是否有一个选项(例如 HTTP 处理程序)可以自定义 url 但仍加载所需的页面?
另外,我还没有弄清楚 MachineKey.Encode 是否使用我在 web.config 文件中定义的 MachineKey 来加密数据,任何人都可以通过支持这一点的网络信息为我确认这一点。
谢谢。
I have used MachineKey.Encode to encrypt a ID that is getting passed as a query string to a page but as expected this is making the URL huge.
Is there a option such as HTTP handlers that could customize the url but still load the required page?
Also I am yet to find out if MachineKey.Encode is using the MachineKey that I have defined in my web.config file to encrypt the data, can anybody confirm this for me with web information that backs this up.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它确实使用了配置的键。
MachineKey
调用MachineKeySection.EncryptOrDecryptData
来执行加密,该加密使用从机器密钥部分配置的加密对象。如果您想亲自查看,有趣的调用是EncryptOrDecryptData
=>EnsureConfig
=>ConfigureEncryptionObject
=>SetKeyOnSymAlgorithm< /代码>
It does indeed use the configured keys.
MachineKey
callsMachineKeySection.EncryptOrDecryptData
to perform the encryption, which uses encryption objects configured from the machine key section. If you want to see for yourself, the interesting calls areEncryptOrDecryptData
=>EnsureConfig
=>ConfigureEncryptionObject
=>SetKeyOnSymAlgorithm