views:

51

answers:

3

I am working on ASP.net pages using C# and I want to check whether my querystring has a particular word in it or not.

For example, I want to check if my querystring has

-?property=7960790,498751465,...,...,...,...
-?project=7960790,3298756,.....,.....,......
+4  A: 
if (Request.QueryString["property"] != null) { ...
Danail
Might better check for `if (!string.IsNullOrEmpty(Request.QueryString ...`
Jan Jongboom
A: 

The Request.QueryString object has a variety of methods and properties you can use to check querystring keys and values.

Andy Rose
Highly inefficient
Jan Jongboom
@Jan - fair enough, not the best code sample I admit, i'll remove it.
Andy Rose
+1  A: 

Use

Request.QueryString["property"];

and check against null.

See Request.QueryString Collection

rahul