Quantcast
Channel: Common Language Runtime Internals and Architecture forum
Viewing all articles
Browse latest Browse all 1710

Get web response from System.Exception (Status Code)

$
0
0

I have a method that fetches data from a web service and does some other functions offline . I have put this code within try/ catch statements . Following is an example of what I'm trying to do .

 Is there a way that I can explicitly identify whether the thrown exception is a WebException ?  (to get responce)     

private SampleMethod()
{
  try 
 {
// get data from web service
        // do other offline stuff
          }
 catch  (System.Exception ex)
          {
              if (// if exception is a web service exception,)
                {
                  // do these
                }

             else (// if exception is not a web exception)
           {
               //do these
           }
    }

}




Viewing all articles
Browse latest Browse all 1710

Trending Articles



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