无法获得Request.QueryString的完整值 [英] Can't get full value for Request.QueryString

查看:64
本文介绍了无法获得Request.QueryString的完整值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我的gridview中有APM 23 X 23#1记录。我点击了这条记录,通过使用以下方法将此值传递给另一个表单:



初始形式:

Hi,

I have "APM 23 X 23 # 1" record in my gridview. I clicked this record, passed this value to another form by using:

Initial form:

e.Row.Attributes.Add("onclick", "javascript:window.location.href ='AutoPMPage.aspx?ID=" + e.Row.Cells[0].Text + "';");





其他形式:



Other form:

string Id = HttpContext.Current.Request.QueryString["id"];







但我无法从字符串Id中获取完整值。我只得到APM 23 X 23。 #1丢失。



任何人都知道为什么?



谢谢!




But i cannot get full value from string Id. I only get "APM 23 X 23". "# 1" is missing.

Anyone know why?

Thanks!

推荐答案





我想你可能在你的机器上部署了一些Url扫描。



简单的解决方案是将#替换为[35],然后在服务器上将其反转。
Hi,

I think you may have some Url scan deployed at you machine.

easy solution is to replace your # with "[35]" and then reverse it at server.


1.
string Id = HttpContext.Current.Request.QueryString["id"];

string Id = HttpContext.Current.Request.QueryString["ID"];//upper id



2.天气与否您的服务器可以获取客户的参数。







我想,你的网址是错的。

我想知道.aspx和.cs的路由


2.Weather or not your server can get the parameter of the client.



I guess,your url is wrong.
I want to know the routes of the .aspx and the .cs


有些字符在放入URL时会被编码。你不应该在代码中替换它们,而应该考虑放置一个

There are some characters that get encoded when put in URL. Instead of replacing them in Code you should think about putting a
Server.UrlEncode(string);



将数据放入查询字符串之前。并且在检索之后执行


before putting the data in query strings. and after retrieving do a

Server.UrlDecode(string);



在使用之前。


before using it.


这篇关于无法获得Request.QueryString的完整值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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