Forum Discussion
MD_59966
Nimbostratus
Aug 17, 2009Help - AxHost+InvalidActiveXStateException was thrown from API
Hi,
I am using FirePass Client API to logon and access favorites for a user. (similar to sample given along with SDK)
However I get "Exception of type System.Windows.Forms.AxHost+InvalidActiveXStateException was thrown". I am not sure how to resolve this issue. Below is the console app I wrote. What am I missing?.. how do I properly initialize the ActiveX object and access Firepass?
Appreciate any help!
Thanks.
namespace testFirepass
{
class Program
{
///
/// Application Tunnels ActiveX control
///
private static AxAPPCTRLLib.AxAppTunnelEx axAppTunnel;
///
/// Favorite array instance (see OnGetFavorites)
///
private static APPCTRLLib.UPropertyArray Favorites = null;
public Program()
{
axAppTunnel.OnOpenSession += new AxAPPCTRLLib._IAppTunnelEventsEx_OnOpenSessionEventHandler(axAppTunnel_OnOpenSession);
axAppTunnel.OnStateChanged += new
axAppTunnel.OnConnected += new AxAPPCTRLLib._IAppTunnelEventsEx_OnConnectedEventHandler(axAppTunnel_OnConnected);
axAppTunnel.OnCheckSessionComplete += new AxAPPCTRLLib._IAppTunnelEventsEx_OnCheckSessionCompleteEventHandler(axAppTunnel_OnCheckSessionComplete);
}
[STAThread]
static void Main(string[] args)
{
try
{
axAppTunnel = new AxAPPCTRLLib.AxAppTunnelEx();
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Resource1));
axAppTunnel.Enabled = true;
axAppTunnel.Name = "axAppTunnel";
axAppTunnel.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axAppTunnel.OcxState")));
axAppTunnel.TabIndex = 0;
axAppTunnel.Visible = false;
string HostName = "firepasshost";
int Port = 443;
string UserName = "usernm";
string Password = "password";
((System.ComponentModel.ISupportInitialize)axAppTunnel).EndInit(); ;
axAppTunnel.CreateControl();
// Open new server session
axAppTunnel.OpenSession(HostName, Port, UserName, Password);
// Close server session%
axAppTunnel.CloseSession();
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
}
private void axAppTunnel_OnOpenSession(object sender, AxAPPCTRLLib._IAppTunnelEventsEx_OnOpenSessionEvent e)
{
Console.WriteLine("opened session successfully");
}
}
}
No RepliesBe the first to reply
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects