How to check that Request.QueryString has a specific value or not in ASP.NET?

前端 未结 8 1277
孤街浪徒
孤街浪徒 2020-12-08 06:12

I have an error.aspx page. If a user comes to that page then it will fetch the error path in page_load() method URL using Request.QueryStrin

8条回答
  •  抹茶落季
    2020-12-08 06:40

    To check for an empty QueryString you should use Request.QueryString.HasKeys property.

    To check if the key is present: Request.QueryString.AllKeys.Contains()

    Then you can get ist's Value and do any other check you want, such as isNullOrEmpty, etc.

提交回复
热议问题