try { // Make a web request here ... } catch (WebException e) { Console.WriteLine("WebException.Status = " + e.Status.ToString()); }
WebExceptionStatus status = WebExceptionStatus.ProtocolError; string statusString = status.ToString();This example shows how to convert a WebExceptionStatus enumeration value into a string representation using the ToString method directly. The WebExceptionStatus.ProtocolError value is assigned to a variable, and then the ToString method is called on that variable to retrieve its string representation. Package library: System.Net.