Posted By

daverussellr on 09/16/10



Versions (?)

Who likes this?

1 person have marked this snippet as a favorite


Check For Key in Querystring

 / Published in: C#

Ensures that the querystring key that you require exists before using it.

  1. if (!string.IsNullOrEmpty(Request.QueryString["somekey"]))
  2. //do some stuff
  3. }

Report this snippet  


RSS Icon Subscribe to comments
Posted By: fnx on September 16, 2010

null check should be first. But why not use string.IsNullOrEmpty()?

Posted By: daverussellr on September 16, 2010

hi fnx, correct, will update.

You need to login to post a comment.