title: CookieContainer and WebServices
body: <p>I have WebService:</p>
  
  <pre><code>public class Service1:WebService {        
          private readonly MNConnection _conn;
          private MNLpu _lpu;
  
          public Service1() {
              _conn = new MNConnection();
          }
  
          [WebMethod(EnableSession = true)]
          public void Open(string login, string password) {
              _conn.Open(login, password);
              _lpu = (MNLpu)_conn.CreateLPU();
          }
  
          [WebMethod(EnableSession = true)]
          public decimal Get() {
              return _lpu.Count;
          }
  }
  </code></pre>
  
  <p>When I call it's from external console application, it's show me NullReferenceException on last line:</p>
  
  <pre><code>    CookieContainer cookie = new CookieContainer();
      Service1 lh = new Service1 {CookieContainer = cookie};
      lh.Open("login", "pwd");
      Console.WriteLine(lh.Get());
  </code></pre>
  
  <p>If remove Open() method from webservice and insert to constructor such lines it's works fine:</p>
  
  <pre><code>        _conn.Open(login, password);
          _lpu = (MNLpu)_conn.CreateLPU();
  </code></pre>
  
  <p>How to fix it?
  P.S. MNConnection - my own class, which works with OracleConnection.</p>