Brad Heller Brad Heller - 1 year ago 80
ASP.NET (C#) Question

Access Query string parameters with no values in ASP.NET

I am trying to set up a page that has two behaviors. I'm separating them by URL: One behavior is accessed via

, the other is via

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
, not
. Anyone have any ideas about this or how to enable this. I'd like to avoid manually parsing the query string at all costs :).

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download