title: How to Connect Attendance Punching Machine Using zKemKeeper in C#?
body: <p>I am developing attendance software using asp.net c#, when iam trying to connect biometric device ( attendance punching machine ) using asp.net c# it shows the error</p>
  
  <p><strong>Error:
  "Attempted to read or write protected memory. This is often an indication that other memory is corrupt."</strong></p>
  
  <p><strong>My Code :</strong></p>
  
  <pre><code>//internal Axzkemkeeper.AxCZKEM AxCZKEM1;
      //public Axzkemkeeper.AxCZKEM axCZKEM1 = new Axzkemkeeper.AxCZKEM();
      //public zkemkeeper.CZKEM axCZKEM1 = new zkemkeeper.CZKEM();
      //public delegate int DecompressMCX(int hComp,IntPtr in, uint in_len, IntPtr out, ref uint out_len, bool eod);
  
      public zkemkeeper.CZKEM axCZKEM1 = new zkemkeeper.CZKEM();
  
  private void Essl_Connect(string IpAddress, int MachineNo)
      {
          try
          {
              bConn = axCZKEM1.Connect_Net(IpAddress.Trim(), 8080);
              //bConn = axCZKEM1.Connect_Net(IpAddress.Trim(), 4370);
              if (bConn == true)
              {
                  ScriptManager.RegisterStartupScript(this, GetType(), "Message", "alert('Connected')", true);
              }
              else
              {
                  ScriptManager.RegisterStartupScript(this, GetType(), "Message", "alert('Not Connected')", true);
              }
          }
          catch (Exception ex)
          {
              ScriptManager.RegisterStartupScript(this, GetType(), "Error Message", "alert('" + ex.Message.ToString() + "')", true);
          }
      }
  </code></pre>
  
  <p>any one rectify this problem, is there any alternative way to connect the machine?..</p>
  
  <p>if iam using </p>
  
  <p><strong>public zkemkeeper.CZKEMClass axCZKEM1 = new zkemkeeper.CZKEMClass();</strong></p>
  
  <p>it shows the following Error:</p>
  
  <p>"Interop type 'zkemkeeper.CZKEMClass' cannot be embedded. Use the applicable interface instead."</p>