| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- //
- // System.Net.WebException.cs
- //
- // Author:
- // Lawrence Pit ([email protected])
- //
- using System.Runtime.Serialization;
- namespace System.Net
- {
- [Serializable]
- public class WebException : InvalidOperationException, ISerializable
- {
- private WebResponse response;
- private WebExceptionStatus status = WebExceptionStatus.RequestCanceled;
-
- // Constructors
-
- public WebException () : base ()
- {
- }
-
- public WebException (string message) : base (message)
- {
- }
- protected WebException (SerializationInfo info,
- StreamingContext context)
- : base (info, context)
- {
- status = (WebExceptionStatus) info.GetInt32 ("web_status");
- response = (WebResponse) info.GetValue ("web_response", typeof (WebResponse));
- }
- public WebException (string message, Exception innerException)
- : base (message, innerException)
- {
- }
- public WebException (string message, WebExceptionStatus status)
- : base (message)
- {
- this.status = status;
- }
- public WebException(string message,
- Exception innerException,
- WebExceptionStatus status,
- WebResponse response)
- : base (message, innerException)
- {
- this.status = status;
- this.response = response;
- }
-
- // Properties
-
- public WebResponse Response {
- get { return this.response; }
- }
-
- public WebExceptionStatus Status {
- get { return this.status; }
- }
-
- // Methods
-
- void ISerializable.GetObjectData (SerializationInfo info, StreamingContext context)
- {
- base.GetObjectData (info, context);
- info.AddValue ("web_status", (int) status, typeof (int));
- info.AddValue ("web_response", response, typeof (WebResponse));
- }
- }
- }
-
|