public HttpCookieSessionBinding()
            : base()
        {
            sessionElement = new HttpCookieSessionBindingElement();

            transportElement = new HttpTransportBindingElement();
            transportElement.AllowCookies = true;

            encodingElement = new TextMessageEncodingBindingElement();
            encodingElement.MessageVersion = MessageVersion.Soap11WSAddressing10;
        }
 protected override BindingElement CreateBindingElement()
 {
     HttpCookieSessionBindingElement bindingElement = 
         new HttpCookieSessionBindingElement();
     
     bindingElement.ExchangeTerminateMessage = exchangeTerminateMessage;
     bindingElement.SessionTimeout = sessionTimeout;
     ApplyConfiguration(bindingElement);
     
     return bindingElement;
 }
        void IPolicyImportExtension.ImportPolicy(MetadataImporter importer, 
            PolicyConversionContext context)
        {
            foreach (XmlElement assertion in context.GetBindingAssertions())
            {
                if (assertion.Name == HttpCookiePolicyStrings.HttpCookiePolicyElement
                    && assertion.NamespaceURI == HttpCookiePolicyStrings.Namespace)
                {
                    HttpCookieSessionBindingElement bindingElement =
                        new HttpCookieSessionBindingElement();

                    XmlAttribute attribute =
                        assertion.Attributes[HttpCookiePolicyStrings.ExchangeTerminateAttribute];

                    if(attribute != null)
                    {
                        bindingElement.ExchangeTerminateMessage = true;
                    }

                    context.BindingElements.Add(bindingElement);
                    break;
                }
            }
        }