问题描述
我想知道如何在简单的asp.net页面中加密/解密你的querystring?
某些值需要在不同页面之间传递,但是查询字符串不能被更改或读取。
有些人说httphandles可能是解决方案。 >
任何想法?
更多背景信息:
hi thx的所有评论。
这是问题,有时会话没有任何理由消失(必须有一个,但我还不知道)。我已经研究了可能的原因,但没有什么可能导致它正在发生。
所以我不能依赖它了。
这个cookie解决方案是一种可能性,但是只需使用querystring就可以实现更多的工作。
该URL可以随时复制,只是没有改变!
干杯,
M。
您必须使用.Net加密之一手动加密。真的这不是查询字符串所用的。如果您不希望用户访问它,您应该找到一种不同的方式在页面之间传递。
这是一个项目,将向您展示如何进行对称加密。
我敢提一下这个,因为它会产生很大的开销,但是你可以在查看状态下发布你的信息,并使用跨页面的帖子来传递周围的信息:
I was wondering how you could encrypt/decrypt your querystring in a simple asp.net page?some values need to be passed between different pages but the querystring cannot be changed or read.
Some say httphandles could be the solution for this.
Any thoughts?
MORE BACKGROUND INFO:
hi thx for all the comments.this is the problem, sometimes the sessions disappear without any reason (well there must be one but I don't know it yet). I've looked into the possible reasons but nothing that could cause it is happening.Therefore I cannot rely on it anymore.The cookie solution is a possibility but it will be more work to implement than simply using the querystring.The url can be copied at any time just not changed!
Cheers,M.
You'll have to encrypt it manually using one of the .Net encryptions. Really this isn't what the query string is for. If you don't want the users to be able to access it, you should find a different way of passing it between pages.
Here is a project that will show you how to do symmetric encryption.http://www.codeproject.com/KB/security/SimpleEncryption.aspx
Dare I mention this, because it will create significant overhead, but you can post your information in the view state and use cross page posts to pass the information around:
这篇关于如何在asp.net中保护/加密querystring?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!