System.Net.WebException HTTP status code

前端 未结 6 1891
执笔经年
执笔经年 2020-12-02 11:27

Is there an easy way to get the HTTP status code from a System.Net.WebException?

6条回答
  •  时光取名叫无心
    2020-12-02 12:17

    I'm not sure if there is but if there was such a property it wouldn't be considered reliable. A WebException can be fired for reasons other than HTTP error codes including simple networking errors. Those have no such matching http error code.

    Can you give us a bit more info on what you're trying to accomplish with that code. There may be a better way to get the information you need.

提交回复
热议问题