title: ASMX: Setting User/Password at run-time
body: <p>When I want to connect to my web service If I write it like this:</p>
  
  <pre><code>m_TransferServiceSoap.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
  </code></pre>
  
  <p>it is working. but I need a Login Form. so users can enter their user/pass </p>
  
  <p>so I am creating a NetworkCredential instance and setting its user/pass members from what I get from that login form and then instead of using the line above I am writing this one:</p>
  
  <pre><code>m_TransferServiceSoap.Credentials = userpass; // the instance above.
  </code></pre>
  
  <p>but in this way when I call a method of that webService, it gives me errors .</p>
  
  <p>Is it the wrong way to set credentials?</p>