title: How to set password type "PasswordText" in the WSSE Security Header with WCF
body: <p>I want to have an wsse security header in which the Password Type is set to &quot;PasswordText&quot; like in the following SOAP snippet:</p>
  <pre><code>&lt;wsse:UsernameToken wsu:Id=&quot;UsernameToken-2&quot;&gt;
     &lt;wsse:UsernaWme&gt;usrnm&lt;/wsse:Username&gt;
     &lt;wsse:Password Type=&quot;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText&quot;&gt;pwd&lt;/wsse:Password&gt;
  &lt;/wsse:UsernameToken&gt;
  </code></pre>
  <p>But all I get is a simple password tag without the Type attribute.</p>
  <pre><code>&lt;wsse:UsernameToken u:Id=&quot;UsernameToken-2&quot;&gt;
    &lt;wsse:Username&gt;usrnm&lt;/wsse:Username&gt;
    &lt;wsse:Password&gt;pwd&lt;/wsse:Password&gt;
  &lt;/wsse:UsernameToken&gt;
  </code></pre>
  <p>What is the proper way to specify it in the code or in the app.cfg?
  Here is my code so far:</p>
  <pre><code>service.ClientCredentials.UserName.UserName = &quot;usrnm&quot;;
  service.ClientCredentials.UserName.Password = &quot;pwd&quot;;
  
  var securityElement = SecurityBindingElement.CreateUserNameOverTransportBindingElement();
  securityElement.AllowInsecureTransport = true;
  
  var encodingElement = new TextMessageEncodingBindingElement(MessageVersion.Soap11, Encoding.UTF8);
  var transportElement = new HttpTransportBindingElement();
  
  var binding = new CustomBinding(securityElement, encodingElement, transportElement);
  service.Endpoint.Binding = binding;
  </code></pre>