How to dump ASP.NET Request headers to string

前端 未结 4 652
暗喜
暗喜 2020-12-08 03:39

I\'d like to email myself a quick dump of a GET request\'s headers for debugging. I used to be able to do this in classic ASP simply with the Request object, but Reque

4条回答
  •  佛祖请我去吃肉
    2020-12-08 04:20

    You can use,

    string headers = Request.Headers.ToString(); 
    

    But It will return URL encoded string so to decode it use below code,

    String headers = HttpUtility.UrlDecode(Request.Headers.ToString()) 
    

提交回复
热议问题