当地址栏没有参数"id"时:
Request.QueryString["ID"] == null
Convert.ToString(Request.QueryString["ID"]) == null
注意这样会出错:
Request.QueryString["ID"].ToString();
当地址栏有参数"id",但没有赋值的时候:
Request.QueryString["ID"] == ""
Request.QueryString["ID"] == String.Empty
Convert.ToString(Request.QueryString["ID"]) == ""
Convert.ToString(Request.QueryString["ID"]) == String.Empty
同时判断二个条件的时候:
if ("" + Request.QueryString["ID"] == "") {...}
if (("" + Request.QueryString["ID"]).Length == 0) {...}
出处:近水楼台 BLOG
(出处:http://www.sheup.com)