如何判断request.QueryString中是否存在参数?
比如:a.aspx?type=1&id=1
我如何判断这个地址中是否有type 和id这两个参数,当然我这里指的不是它们的值,只是参数名.
------解决方案--------------------------------------------------------
- C# code
if (Request.QueryString["type"] != null){ // 存在 type 参数}if (Request.QueryString["id"] != null){ // 存在 id 参数}
------解决方案--------------------------------------------------------
1楼就可以,没必要try ,catch