隐藏查询字符串中的参数 [英] hide parameters in querystring

查看:97
本文介绍了隐藏查询字符串中的参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





正在开发网络应用程序,当我从一个网页重定向到另一个网页

查询字符串显示所有参数。



例如:

折叠|复制代码

Response.Redirect(〜/ User.aspx?UserName =+ txtuser.Text.Replace(&,%26)+

&Password =+ txtpwd.Text.Replace(&,%26));



在查询字符串中显示用户名和密码。



但密码不适用于浏览器中的查询字符串





如何解决it。



am developing web application,when i redirect from one web page to another webpage
query string is displyed with all the parameters.

Eg:
Collapse | Copy Code
Response.Redirect("~/User.aspx?UserName=" + txtuser.Text.Replace("&", "%26") +
"&Password=" + txtpwd.Text.Replace("&", "%26"));

in the querystring it's displying username and password.

but password don't apper on query string in browser


How to solve it.

推荐答案

简单的你可以使用加密和解密方法。



传递参数时第二页只是对用户名和密码进行了加密并发送到另一个页面。

在另一个页面中使用相同的解密算法来获取用户名和密码的原始值。



对于对称加密,请查看MSDN文档和示例:



System.Security.Cryptography.Aes

System.Security.Cryptography.DES

System.Security.Cryptography.RC2

System.Security.Cryptography.Rijndael

System.Security.Cryptography.TripleDES



对于非对称加密,请查看MSDN文档和示例:



System.Security.Cryptography.DSA

System.Security.Cryptography.ECDiffieHellman

System.Security。 Cryptography.ECDsa

System.Security.Cryptography.RSA





如果你不想看到那个解密后的值,然后只将值存储在会话变量中。但是这里需要小心处理会话
Simple you can use encrypt and decrypt method for this.

While passing parameters to second page just do encrupty the username and password and send to another page.
And in another page just use same decrypt algorithm to get original values of username and password.

For symmetric encryption, check out the MSDN doc and examples:

System.Security.Cryptography.Aes
System.Security.Cryptography.DES
System.Security.Cryptography.RC2
System.Security.Cryptography.Rijndael
System.Security.Cryptography.TripleDES

For asymmetric encryption, check out the MSDN doc and examples:

System.Security.Cryptography.DSA
System.Security.Cryptography.ECDiffieHellman
System.Security.Cryptography.ECDsa
System.Security.Cryptography.RSA


If you do not want to visible that decrypted value,then just stored the values in session variable.But here you need to be carefull for session handling


这篇关于隐藏查询字符串中的参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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