Share via


Sys.Net.WebServiceError.statusCode Property

Gets the underlying HTTP error status code for the Web request.

var statusCode = error.get_statusCode();

Return Value

The HTTP error status code for the response.

Remarks

Use this property to identify error conditions in an HTTP response. For a list of possible HTTP status code values, see HTTP Status Codes on the MSDN Web site.

You can use the Sys.Net.WebServiceError.statusCode property to customize the handling of specific HTTP errors. For example, a Web service might fail because it requires URL authorization. In that case, you would look for a 401 (unauthorized) status code, and you could then inform the user that a logon is required.

For an example, see the Sys.Net.WebServiceError class overview.

See Also

Other Resources

Calling Web Services from Client Script in ASP.NET AJAX