欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

ASP IE地址栏参数的判断

程序员文章站 2024-02-03 09:49:16
当地址栏没有参数"id"时: 复制代码 代码如下:request.querystring["id"] == null convert.tostring(reque...
当地址栏没有参数"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) {...}