3 using System
.ServiceModel
;
5 namespace System
.ServiceModel
.Channels
7 public class HttpCookieContainerBindingElement
: BindingElement
9 HttpCookieContainerManager manager
;
11 public HttpCookieContainerBindingElement ()
13 manager
= new HttpCookieContainerManager ();
16 protected HttpCookieContainerBindingElement (HttpCookieContainerBindingElement elementToBeCloned
)
18 if (elementToBeCloned
== null)
19 throw new ArgumentNullException ("elementToBeCloned");
21 manager
= new HttpCookieContainerManager (elementToBeCloned
.manager
);
24 public override IChannelFactory
<TChannel
> BuildChannelFactory
<TChannel
> (BindingContext context
)
27 throw new ArgumentNullException ("context");
28 //context.RemainingBindingElements.Add (this);
29 return base.BuildChannelFactory
<TChannel
> (context
);
32 public override BindingElement
Clone ()
34 return new HttpCookieContainerBindingElement (this);
37 public override T GetProperty
<T
> (BindingContext context
)
40 return (T
) (object) manager
;
41 return context
.GetInnerProperty
<T
> ();
45 class HttpCookieContainerManager
: IHttpCookieContainerManager
47 public HttpCookieContainerManager ()
49 CookieContainer
= new CookieContainer ();
52 public HttpCookieContainerManager (HttpCookieContainerManager original
)
54 CookieContainer
= original
.CookieContainer
;
57 public CookieContainer CookieContainer { get; set; }