Quantcast
Channel: System.Net.WebException HTTP status code - Stack Overflow
Viewing all articles
Browse latest Browse all 7

Answer by pr0gg3r for System.Net.WebException HTTP status code

$
0
0

this works only if WebResponse is a HttpWebResponse.

try{    ...}catch (System.Net.WebException exc){    var webResponse = exc.Response as System.Net.HttpWebResponse;    if (webResponse != null &&         webResponse.StatusCode == System.Net.HttpStatusCode.Unauthorized)    {        MessageBox.Show("401");    }    else        throw;}

Viewing all articles
Browse latest Browse all 7

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>