当前位置: 代码迷 >> ASP.NET >> 怎么判断request.QueryString中是否存在参数
  详细解决方案

怎么判断request.QueryString中是否存在参数

热度:1489   发布时间:2013-02-25 00:00:00.0
如何判断request.QueryString中是否存在参数?
如何判断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
  相关解决方案