3 using System.ServiceModel;
5 namespace System.ServiceModel.Channels
8 [Obsolete ("Use AllowCookies.")]
10 public class HttpCookieContainerBindingElement : BindingElement
12 HttpCookieContainerManager manager;
14 public HttpCookieContainerBindingElement ()
16 manager = new HttpCookieContainerManager ();
19 protected HttpCookieContainerBindingElement (HttpCookieContainerBindingElement elementToBeCloned)
21 if (elementToBeCloned == null)
22 throw new ArgumentNullException ("elementToBeCloned");
24 manager = new HttpCookieContainerManager (elementToBeCloned.manager);
27 public override IChannelFactory<TChannel> BuildChannelFactory<TChannel> (BindingContext context)
30 throw new ArgumentNullException ("context");
31 //context.RemainingBindingElements.Add (this);
32 return base.BuildChannelFactory<TChannel> (context);
35 public override BindingElement Clone ()
37 return new HttpCookieContainerBindingElement (this);
40 public override T GetProperty<T> (BindingContext context)
43 return (T) (object) manager;
44 return context.GetInnerProperty<T> ();
48 class HttpCookieContainerManager : IHttpCookieContainerManager
50 public HttpCookieContainerManager ()
52 CookieContainer = new CookieContainer ();
55 public HttpCookieContainerManager (HttpCookieContainerManager original)
57 CookieContainer = original.CookieContainer;
60 public CookieContainer CookieContainer { get; set; }