Converting/accessing QueryString values in ASP.NET

后端 未结 7 1598
长情又很酷
长情又很酷 2021-01-30 14:44

I\'m curious what everyone does for handling/abstracting the QueryString in ASP.NET. In some of our web apps I see a lot of this all over the site:

int val = 0;         


        
7条回答
  •  离开以前
    2021-01-30 15:32

    According to me, The best way to get querystring value is like following:
    If the querystring is not found then the value of val will be 0.

    int val = 0;
    int.TryParse(Request.QueryString["someKey"], out val);
    

提交回复
热议问题