title: .Net Error - System.AccessViolationException: Attempted to read or write protected memory
body: <p>I am using server side active x control for paging (http://activexperts.com/xmstoolkit/). The code below worked find on windows 2003 servers but now we moved to windows 2008 and I am getting the following error: </p>
  
  <blockquote>
    <p>System.AccessViolationException: Attempted to read or write protected
    memory. This is often an indication
    that other memory is corrupt. at
    AXmsCtrl.PagerProtocolSnppClass.Clear()
    at _Default.Button1_Click(Object
    sender, EventArgs e) in
    D:\Apps\pagetest\Default.aspx.vb:line
    15</p>
  </blockquote>
  
  <p>I've searched and read various threads but am not able to find solution. Thanks in advance for your help.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>Partial Class _Default
      Inherits System.Web.UI.Page
      Private objSnppProtocol As PagerProtocolSnpp = New PagerProtocolSnpp
      Private objPagerMessage As PagerMessage = New PagerMessage
  
      Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
          Try
  
              objPagerMessage.Clear()
              objPagerMessage.Recipient = "12345"
              objPagerMessage.Data = "Testing send page."
  
              objSnppProtocol.Clear()
              objSnppProtocol.Server = "111.111.11.11"
              objSnppProtocol.ServerPort = System.Int32.Parse("446")
              objSnppProtocol.ServerTimeout = 2000
  
              objSnppProtocol.ProviderPassword = "2125551212 2125551212"
              objSnppProtocol.LogFile = Server.MapPath("log.txt")
  
              ' Send
              objSnppProtocol.Send(objPagerMessage)
              UpdateResult(objSnppProtocol.LastError, objSnppProtocol.ProviderResponse)
          Catch exc As Exception
              Response.Write("&lt;br&gt;&lt;font color='maroon'&gt;&lt;strong&gt;Paging ERROR:&lt;/strong&gt;&lt;/font&gt;&lt;br&gt;" &amp; exc.ToString() &amp; "&lt;br&gt;Trace: " &amp; exc.StackTrace.ToString())
          End Try
      End Sub
  
      Private Sub UpdateResult(ByVal numResult As System.Int32, ByVal strResponse As String)
          ctlResult.Text = numResult.ToString() &amp; ": " &amp; objSnppProtocol.GetErrorDescription(numResult)
          ctlResponse.Text = strResponse
      End Sub
  End Class
  </code></pre>