查询字符串参数没有值 [英] Query string parameters with no values
问题描述
我想建立一个具有两种行为的页面。我被URL他们分隔条件:一是行为是通过访问/有些控制器/一些行动
,另一种是通过 /有些控制器/一些行动?定制
。
I am trying to set up a page that has two behaviors. I'm seperating them by URL: One behavior is accessed via /some-controller/some-action
, the other is via /some-controller/some-action?customize
.
它看起来并不像的Request.QueryString对象包含什么,不过,当我访问了第二个URL ......我的意思是,领取钥匙中有一个元素,但它的空
,而不是自定义
。任何人有这个或任何想法如何启用此功能。我想,以避免手动不惜一切代价解析查询字符串。)
It doesn't look like the Request.QueryString object contains anything, though, when I visit the second URL...I mean, the keys collection has one element in it, but it's null
, not 'customize'
. Anyone have any ideas about this or how to enable this. I'd like to avoid manually parsing the query string at all costs :).
推荐答案
ASP.NET不支持确定的查询字符串参数presence没有值,因为的Request.QueryString [自定义]
和的Request.QueryString [富]
都是空
。你要么必须自己解析它,或如指定值?自定义= 1
ASP.NET does not support determining the presence of query string parameters without values since Request.QueryString["customize"]
and Request.QueryString["foo"]
are both null
. You'll either have to parse it yourself or specify a value e.g. ?customize=1
这篇关于查询字符串参数没有值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!