Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / Net / System / Net / WebException.cs / 1 / WebException.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Net { using System; using System.Runtime.Serialization; using System.Security.Permissions; /*++ Abstract: Contains the defintion for the WebException object. This is a subclass of Exception that contains a WebExceptionStatus and possible a reference to a WebResponse. --*/ ////// [Serializable] public class WebException : InvalidOperationException, ISerializable { private WebExceptionStatus m_Status = WebExceptionStatus.UnknownError; //Should be changed to GeneralFailure; private WebResponse m_Response; [NonSerialized] private WebExceptionInternalStatus m_InternalStatus = WebExceptionInternalStatus.RequestFatal; ////// Provides network communication exceptions to the application. /// /// This is the exception that is thrown by WebRequests when something untoward /// happens. It's a subclass of WebException that contains a WebExceptionStatus and possibly /// a reference to a WebResponse. The WebResponse is only present if we actually /// have a response from the remote server. /// ////// public WebException() { } ////// Creates a new instance of the ////// class with the default status /// from the /// values. /// /// public WebException(string message) : this(message, null) { } ////// Creates a new instance of the ///class with the specified error /// message. /// /// public WebException(string message, Exception innerException) : base(message, innerException) { } public WebException(string message, WebExceptionStatus status) : this(message, null, status, null) { } ////// Creates a new instance of the ///class with the specified error /// message and nested exception. /// /// Message - Message string for exception. /// InnerException - Exception that caused this exception. /// /// /// internal WebException(string message, WebExceptionStatus status, WebExceptionInternalStatus internalStatus, Exception innerException) : this(message, innerException, status, null, internalStatus) { } ////// Creates a new instance of the ///class with the specified error /// message and status. /// /// Message - Message string for exception. /// Status - Network status of exception /// /// public WebException(string message, Exception innerException, WebExceptionStatus status, WebResponse response) : this(message, null, innerException, status, response) { } internal WebException(string message, string data, Exception innerException, WebExceptionStatus status, WebResponse response) : base(message + (data != null ? ": '" + data + "'" : ""), innerException) { m_Status = status; m_Response = response; } internal WebException(string message, Exception innerException, WebExceptionStatus status, WebResponse response, WebExceptionInternalStatus internalStatus) : this(message, null, innerException, status, response, internalStatus) { } internal WebException(string message, string data, Exception innerException, WebExceptionStatus status, WebResponse response, WebExceptionInternalStatus internalStatus) : base(message + (data != null ? ": '" + data + "'" : ""), innerException) { m_Status = status; m_Response = response; m_InternalStatus = internalStatus; } protected WebException(SerializationInfo serializationInfo, StreamingContext streamingContext) : base(serializationInfo, streamingContext) { // m_Status = (WebExceptionStatus)serializationInfo.GetInt32("Status"); // m_InternalStatus = (WebExceptionInternalStatus)serializationInfo.GetInt32("InternalStatus"); } ////// Creates a new instance of the ///class with the specified error /// message, nested exception, status and response. /// /// Message - Message string for exception. /// InnerException - The exception that caused this one. /// Status - Network status of exception /// Response - The WebResponse we have. /// [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)] void ISerializable.GetObjectData(SerializationInfo serializationInfo, StreamingContext streamingContext) { GetObjectData(serializationInfo, streamingContext); } [SecurityPermissionAttribute(SecurityAction.LinkDemand, Flags=SecurityPermissionFlag.SerializationFormatter)] public override void GetObjectData(SerializationInfo serializationInfo, StreamingContext streamingContext){ base.GetObjectData(serializationInfo, streamingContext); //serializationInfo.AddValue("Status", (int)m_Status, typeof(int)); //serializationInfo.AddValue("InternalStatus", (int)m_InternalStatus, typeof(int)); } /// /// public WebExceptionStatus Status { get { return m_Status; } } ////// Gets the status of the response. /// ////// public WebResponse Response { get { return m_Response; } } ////// Gets the error message returned from the remote host. /// ////// internal WebExceptionInternalStatus InternalStatus { get { return m_InternalStatus; } } }; // class WebException internal enum WebExceptionInternalStatus { RequestFatal = 0, ServicePointFatal = 1, Recoverable = 2, Isolated = 3, } } // namespace System.Net // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ ///// Gets the error message returned from the remote host. /// ///// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Net { using System; using System.Runtime.Serialization; using System.Security.Permissions; /*++ Abstract: Contains the defintion for the WebException object. This is a subclass of Exception that contains a WebExceptionStatus and possible a reference to a WebResponse. --*/ ////// [Serializable] public class WebException : InvalidOperationException, ISerializable { private WebExceptionStatus m_Status = WebExceptionStatus.UnknownError; //Should be changed to GeneralFailure; private WebResponse m_Response; [NonSerialized] private WebExceptionInternalStatus m_InternalStatus = WebExceptionInternalStatus.RequestFatal; ////// Provides network communication exceptions to the application. /// /// This is the exception that is thrown by WebRequests when something untoward /// happens. It's a subclass of WebException that contains a WebExceptionStatus and possibly /// a reference to a WebResponse. The WebResponse is only present if we actually /// have a response from the remote server. /// ////// public WebException() { } ////// Creates a new instance of the ////// class with the default status /// from the /// values. /// /// public WebException(string message) : this(message, null) { } ////// Creates a new instance of the ///class with the specified error /// message. /// /// public WebException(string message, Exception innerException) : base(message, innerException) { } public WebException(string message, WebExceptionStatus status) : this(message, null, status, null) { } ////// Creates a new instance of the ///class with the specified error /// message and nested exception. /// /// Message - Message string for exception. /// InnerException - Exception that caused this exception. /// /// /// internal WebException(string message, WebExceptionStatus status, WebExceptionInternalStatus internalStatus, Exception innerException) : this(message, innerException, status, null, internalStatus) { } ////// Creates a new instance of the ///class with the specified error /// message and status. /// /// Message - Message string for exception. /// Status - Network status of exception /// /// public WebException(string message, Exception innerException, WebExceptionStatus status, WebResponse response) : this(message, null, innerException, status, response) { } internal WebException(string message, string data, Exception innerException, WebExceptionStatus status, WebResponse response) : base(message + (data != null ? ": '" + data + "'" : ""), innerException) { m_Status = status; m_Response = response; } internal WebException(string message, Exception innerException, WebExceptionStatus status, WebResponse response, WebExceptionInternalStatus internalStatus) : this(message, null, innerException, status, response, internalStatus) { } internal WebException(string message, string data, Exception innerException, WebExceptionStatus status, WebResponse response, WebExceptionInternalStatus internalStatus) : base(message + (data != null ? ": '" + data + "'" : ""), innerException) { m_Status = status; m_Response = response; m_InternalStatus = internalStatus; } protected WebException(SerializationInfo serializationInfo, StreamingContext streamingContext) : base(serializationInfo, streamingContext) { // m_Status = (WebExceptionStatus)serializationInfo.GetInt32("Status"); // m_InternalStatus = (WebExceptionInternalStatus)serializationInfo.GetInt32("InternalStatus"); } ////// Creates a new instance of the ///class with the specified error /// message, nested exception, status and response. /// /// Message - Message string for exception. /// InnerException - The exception that caused this one. /// Status - Network status of exception /// Response - The WebResponse we have. /// [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)] void ISerializable.GetObjectData(SerializationInfo serializationInfo, StreamingContext streamingContext) { GetObjectData(serializationInfo, streamingContext); } [SecurityPermissionAttribute(SecurityAction.LinkDemand, Flags=SecurityPermissionFlag.SerializationFormatter)] public override void GetObjectData(SerializationInfo serializationInfo, StreamingContext streamingContext){ base.GetObjectData(serializationInfo, streamingContext); //serializationInfo.AddValue("Status", (int)m_Status, typeof(int)); //serializationInfo.AddValue("InternalStatus", (int)m_InternalStatus, typeof(int)); } /// /// public WebExceptionStatus Status { get { return m_Status; } } ////// Gets the status of the response. /// ////// public WebResponse Response { get { return m_Response; } } ////// Gets the error message returned from the remote host. /// ////// internal WebExceptionInternalStatus InternalStatus { get { return m_InternalStatus; } } }; // class WebException internal enum WebExceptionInternalStatus { RequestFatal = 0, ServicePointFatal = 1, Recoverable = 2, Isolated = 3, } } // namespace System.Net // File provided for Reference Use Only by Microsoft Corporation (c) 2007./// Gets the error message returned from the remote host. /// ///
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ClusterSafeNativeMethods.cs
- HttpDateParse.cs
- BCLDebug.cs
- FlowNode.cs
- _AutoWebProxyScriptHelper.cs
- PerformanceCounterCategory.cs
- smtpconnection.cs
- XmlBaseReader.cs
- PreloadedPackages.cs
- NopReturnReader.cs
- DataControlCommands.cs
- InProcStateClientManager.cs
- AutomationElement.cs
- ControlCollection.cs
- Trace.cs
- DataGridViewButtonColumn.cs
- Line.cs
- SQLInt64.cs
- BehaviorDragDropEventArgs.cs
- DataTableReader.cs
- GetWinFXPath.cs
- columnmapfactory.cs
- XMLUtil.cs
- CannotUnloadAppDomainException.cs
- FormatVersion.cs
- RadialGradientBrush.cs
- COM2PropertyBuilderUITypeEditor.cs
- WorkflowOperationContext.cs
- ButtonRenderer.cs
- Floater.cs
- DataGridColumn.cs
- DbConnectionFactory.cs
- SHA1Managed.cs
- ColorBuilder.cs
- AssemblyCollection.cs
- DynamicVirtualDiscoSearcher.cs
- BinaryUtilClasses.cs
- HostedHttpContext.cs
- CodeAttributeArgumentCollection.cs
- Repeater.cs
- IssuanceLicense.cs
- Point3DConverter.cs
- XPathMessageFilter.cs
- TreeChangeInfo.cs
- BCLDebug.cs
- PhysicalAddress.cs
- SystemDropShadowChrome.cs
- Viewport2DVisual3D.cs
- ListViewHitTestInfo.cs
- CircleHotSpot.cs
- ActivityExecutorSurrogate.cs
- DynamicUpdateCommand.cs
- SqlCacheDependency.cs
- PerformanceCounterManager.cs
- ToolBarButtonClickEvent.cs
- SocketInformation.cs
- MetadataCollection.cs
- WorkerRequest.cs
- DataBoundControl.cs
- JsonWriter.cs
- MasterPageCodeDomTreeGenerator.cs
- WebPartConnectionsCancelEventArgs.cs
- CRYPTPROTECT_PROMPTSTRUCT.cs
- SlotInfo.cs
- BitmapVisualManager.cs
- TouchesOverProperty.cs
- TargetException.cs
- InputMethod.cs
- LayoutEngine.cs
- DatatypeImplementation.cs
- DataGridrowEditEndingEventArgs.cs
- xml.cs
- FormViewDeletedEventArgs.cs
- SubpageParagraph.cs
- CheckBox.cs
- ResXBuildProvider.cs
- GridViewColumnHeaderAutomationPeer.cs
- PipeException.cs
- DocumentSequenceHighlightLayer.cs
- FatalException.cs
- ObjectReferenceStack.cs
- RadioButtonPopupAdapter.cs
- DocumentViewer.cs
- XmlSchemaDocumentation.cs
- ProfileServiceManager.cs
- TextEditorSelection.cs
- HashCodeCombiner.cs
- ObjectStateEntryOriginalDbUpdatableDataRecord.cs
- CompositeFontInfo.cs
- AccessibleObject.cs
- UserInitiatedNavigationPermission.cs
- MemberHolder.cs
- ServiceDescriptionReflector.cs
- PersianCalendar.cs
- Adorner.cs
- MarkupCompilePass1.cs
- InvalidEnumArgumentException.cs
- WindowsListViewGroup.cs
- JournalEntry.cs
- WorkItem.cs