How to get a querystring when it is URLEncoded or has percent characters in ASP.NET

前端 未结 4 2105
Happy的楠姐
Happy的楠姐 2021-01-15 09:50

How to get the actual querystring from the Request object when the querystring is UrlEncoded or has percent characters in ASP.NET?

Basicly, if I have a Url like t

4条回答
  •  梦毁少年i
    2021-01-15 10:18

    Asp.net will automatically URL Decode stuff when you do Request.Querystring["key"]. You just need to encode it again.

    HttpUtility.UrlEncode(Request.QueryString["p"])
    

提交回复
热议问题