我如何从request.querystring获得全部价值. [英] How do i get full value from request.querystring.
本文介绍了我如何从request.querystring获得全部价值.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
localhost1090:/dome/first.aspx?ID = asdh&92k
当我转换为字符串时,它将仅显示"asdh".它会删除其余的&928"值.
localhost1090:/dome/first.aspx?ID=asdh&92k
When I convert to string it will show me just ''asdh''. It removes rest of value ''&928''.
What to do?
推荐答案
''&''和``=''是查询字符串的限制器.如果您有&在您的查询字符串中,它将假定您正在传递另一个变量的值.
通常就像
''&'' and ''='' is limiter for querystring. if you have & in your querystring it will assume that your are passing value for another variable.
genrally it is like
localhost1090:/dome/first.aspx?ID=asdh&VAL=92k
更好的建议不要使用&在您的查询字符串中.
better suggestion do not use & in your querystring.
您可以使用
You can use
localhost1090:/dome/first.aspx?ID=asdh&NAME=92k
然后通过查询字符串接收
then receive by query string
string id=Request.QueryString["ID"] ;
string na=Request.QueryString["NAME"] ;
string FINAL = id +"&"+na;
您可以同时接收两个值.
you can receive both values.
您需要对URL进行编码:
you need to encode the URL:
String MyURL;
MyURL = "http://localhost1090:/dome/first.aspx?ID=" + Server.UrlEncode("asdh&92k
");
这篇关于我如何从request.querystring获得全部价值.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文