地址栏参数的判断总结
类别: ASP教程
当地址栏没有参数"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) {...}
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) {...}
-= 资 源 教 程 =-
文 章 搜 索