IEApp.Navigate throwing automated error when navigating to https sites

Add-in Express™ Support Service
That's what is more important than anything else

IEApp.Navigate throwing automated error when navigating to https sites
IEApp.Navigate throwing automated error when navigating to https sites 
Shawn Fenus




Posts: 16
Joined: 2010-01-08
I am getting an error when navigating to https site when invoking the IEApp.Navigate method. I have removed the this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); Sometime I do not get an error. Any help would be great. thanks in advance.

HERE IS THE CODE I AM USING:
==========================

System.Object one = 0x0800;
System.Object two = "_self";
System.Object three = null;
System.Object four = null;
IEApp.Navigate(@"http://www.somesite.net/member/app/registration", ref one, ref two, ref three, ref four);


HERE IS THE ERROR
=================
Detailed technical information follows:
---
(Inner Exception)
(Inner Exception)
Date and Time: 2/14/2010 10:07:47 PM
Machine Name: KEMESA-TEST2
IP Address: 10.200.200.154
Current User: KEMESA-TEST2\admin

Application Domain: C:\Development\NEW_IECompanion\IECompanion\Companion\bin\Debug\
Assembly Codebase: file:///C:/WINDOWS/assembly/GAC_MSIL/AddinExpress.IE/5.2.261.0__4416dd98f0861965/AddinExpress.IE.dll
Assembly Full Name: AddinExpress.IE, Version=5.2.261.0, Culture=neutral, PublicKeyToken=4416dd98f0861965
Assembly Version: 5.2.261.0
Assembly Build Date: 11/18/2009 5:29:40 PM

Exception Source:
Exception Type: System.Runtime.InteropServices.COMException
Exception Message: Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))
Exception Target Site: Object reference not set to an instance of an object.

---- Stack Trace ----



(Outer Exception)
Date and Time: 2/14/2010 10:07:47 PM
Machine Name: KEMESA-TEST2
IP Address: 10.200.200.154
Current User: KEMESA-TEST2\admin

Application Domain: C:\Development\NEW_IECompanion\IECompanion\Companion\bin\Debug\
Assembly Codebase: file:///C:/WINDOWS/assembly/GAC_MSIL/AddinExpress.IE/5.2.261.0__4416dd98f0861965/AddinExpress.IE.dll
Assembly Full Name: AddinExpress.IE, Version=5.2.261.0, Culture=neutral, PublicKeyToken=4416dd98f0861965
Assembly Version: 5.2.261.0
Assembly Build Date: 11/18/2009 5:29:40 PM

Exception Source: mscorlib
Exception Type: System.Reflection.TargetInvocationException
Exception Message: Exception has been thrown by the target of an invocation.
Exception Target Site: InvokeDispMethod

---- Stack Trace ----
System.RuntimeType.InvokeDispMethod(name As String, invokeAttr As BindingFlags, target As Object, args As Object[], byrefModifiers As Boolean[], culture As Int32, namedParameters As String[])
AddinExpress.IE.dll: N 00000 (0x0) JIT
System.RuntimeType.InvokeMember(name As String, bindingFlags As BindingFlags, binder As Binder, target As Object, providedArgs As Object[], modifiers As ParameterModifier[], culture As CultureInfo, namedParams As String[])
AddinExpress.IE.dll: N 0488 (0x1E8) IL
System.Type.InvokeMember(name As String, invokeAttr As BindingFlags, binder As Binder, target As Object, args As Object[])
AddinExpress.IE.dll: N 0000 (0x0) IL
AddinExpress.IE.ADXIEModule.get_HTMLDocumentObj()
AddinExpress.IE.dll: N 0008 (0x8) IL
ShopShieldCompanion.IEModule.get_HTMLDocument()
IEModule.cs: line 0189, col 17, IL 0001 (0x1)
ShopShieldCompanion.IEModule.IEModule_OnTabActivated(sender As Object, e As EventArgs)
IEModule.cs: line 0447, col 13, IL 0032 (0x20)
AddinExpress.IE.ADXIEModule.DoTabActivated()
AddinExpress.IE.dll: N 0008 (0x8) IL



(Outer Exception)
Date and Time: 2/14/2010 10:07:47 PM
Machine Name: KEMESA-TEST2
IP Address: 10.200.200.154
Current User: KEMESA-TEST2\admin

Application Domain: C:\Development\NEW_IECompanion\IECompanion\Companion\bin\Debug\
Assembly Codebase: file:///C:/WINDOWS/assembly/GAC_MSIL/AddinExpress.IE/5.2.261.0__4416dd98f0861965/AddinExpress.IE.dll
Assembly Full Name: AddinExpress.IE, Version=5.2.261.0, Culture=neutral, PublicKeyToken=4416dd98f0861965
Assembly Version: 5.2.261.0
Assembly Build Date: 11/18/2009 5:29:40 PM

Exception Source:
Exception Type: AddinExpress.IE.ADXIEExternalException
Exception Message: An error has occured in the code of the extension.
Exception Target Site: Object reference not set to an instance of an object.

---- Stack Trace ----
Posted 14 Feb, 2010 23:20:24 Top
Sergey Grischenko


Add-in Express team


Posts: 7202
Joined: 2004-07-05
Hi Shawn.

Please use OnConnect event handler for navigating when a new tab is opened.
Posted 15 Feb, 2010 10:54:34 Top
Shawn Fenus




Posts: 16
Joined: 2010-01-08
Thanks for your quick response. I tried this and now I am getting the following.

ERROR MESSAGE:
Error HRESULT E_FAIL has been returned from a call to a COM component

STACK TRACE:
at Interop.SHDocVw.IWebBrowser2.Navigate(String URL, Object& Flags, Object& TargetFrameName, Object& PostData, Object& Headers)
at Companion.IEModule.IEModule_OnConnect(Object sender, Int32 threadId) in C:\Development\NEW_IECompanion\IECompanion\Companion\IEModule.cs:line:XXX

THIS IS THE CODE:
private void IEModule_OnConnect(object sender, int threadId)
{
var ulaForm = new UserAgreement();
DialogResult result = ulaForm.ShowDialog();
if (result == DialogResult.Yes)
{
System.Object one = 0x0800;
System.Object two = "_self";
System.Object three = null;
System.Object four = null;
IEApp.Navigate(@"http://www.someplace.net/member/app/registration", ref one, ref two, ref three, ref four);
}
}
Posted 15 Feb, 2010 21:24:42 Top
Shawn Fenus




Posts: 16
Joined: 2010-01-08
Any ideas on this thread. I tried putting it in the OnSendMessage and using both the SendMessage and SendMessageToAll to call it. I looked at the Search Advanced Example to see if there was something I was doing different to no avail. Also peculiar is it works on some XP machines and not others. I am always sure to run a full windows update. Please any idea would be helpful. Thanks in advance.
Posted 16 Feb, 2010 11:15:44 Top
Sergey Grischenko


Add-in Express team


Posts: 7202
Joined: 2004-07-05
Hi Shawn.

Please test the code below.

[ComVisible(true), Guid("91ED4C47-3C42-4EDB-9535-C828690D175D")]
public class IEModule : AddinExpress.IE.ADXIEModule, IWin32Window
{
public IEModule()
{
InitializeComponent();
}

public IEModule(IContainer container)
{
container.Add(this);

InitializeComponent();
}

#region Component Designer generated code
/// <summary>
/// Required by designer
/// </summary>
private System.ComponentModel.IContainer components;

/// <summary>
/// Required by designer support - do not modify
/// the following method
/// </summary>
private void InitializeComponent()
{
//
// IEModule
//
this.ModuleName = "MyIEAddon24";
this.OnSendMessage += new AddinExpress.IE.ADXIESendMessage_EventHandler(this.IEModule_OnSendMessage);
this.OnConnect += new AddinExpress.IE.ADXIEConnect_EventHandler(this.IEModule_OnConnect);

}
#endregion

#region ADX automatic code

// Required by Add-in Express - do not modify
// the methods within this region

public override System.ComponentModel.IContainer GetContainer()
{
if (components == null)
components = new System.ComponentModel.Container();
return components;
}

[ComRegisterFunctionAttribute]
public static void RegisterIEModule(Type t)
{
AddinExpress.IE.ADXIEModule.RegisterIEModuleInternal(t);
}

[ComUnregisterFunctionAttribute]
public static void UnregisterIEModule(Type t)
{
AddinExpress.IE.ADXIEModule.UnregisterIEModuleInternal(t);
}

[ComVisible(true)]
public class IECustomContextMenuCommands :
AddinExpress.IE.ADXIEModule.ADXIEContextMenuCommandDispatcher
{
}

[ComVisible(true)]
public class IECustomCommands :
AddinExpress.IE.ADXIEModule.ADXIECommandDispatcher
{
}

#endregion

public IE.WebBrowser IEApp
{
get
{
return (this.IEObj as IE.WebBrowser);
}
}

public mshtml.HTMLDocument HTMLDocument
{
get
{
return (this.HTMLDocumentObj as mshtml.HTMLDocument);
}
}

private void IEModule_OnConnect(object sender, int threadId)
{
this.SendMessage(0x400 + 1000, IntPtr.Zero, IntPtr.Zero);
}

private void IEModule_OnSendMessage(AddinExpress.IE.ADXIESendMessageEventArgs e)
{
if (e.Message == 0x400 + 1000)
{
MyForm f = null;

try
{
f = new MyForm();
if (f.ShowDialog(this) == DialogResult.OK)
{
System.Object one = null;
System.Object two = null;
System.Object three = null;
System.Object four = null;

IEApp.Navigate(@"//www.add-in-express.com", ref one, ref two, ref three, ref four);
}
}
finally
{
if (f != null)
f.Dispose();
}
}
}

public IntPtr Handle
{
get
{
return this.ParentHandle;
}
}
}
Posted 16 Feb, 2010 13:52:35 Top
Shawn Fenus




Posts: 16
Joined: 2010-01-08
Thanks for the input. I tried the above code with no better results. So I created a blank solution deployed to an XP machine with version IE Explorer 7.0.5730.13. I got an Windows Internet Explorer error box saying "Internet Explorer cannot open site https://www.somesite.net/member/app/registration."

Operation aborted"

Different problem same result - I cannot navigate to the page. It works on Windows XP-IE8 just fine - But not Windows XP-IE7

Thanks for your time. Please advise.


HERE IS THE CODE I AM USING:
using System;
using System.Runtime.InteropServices;
using System.ComponentModel;
using System.Windows.Forms;
using IE = Interop.SHDocVw;

namespace TestAddon
{
/// <summary>
/// Add-in Express .NET for Internet Explorer Module
/// </summary>
[ComVisible(true), Guid("B5B883D1-E9AE-4EB2-BC88-4BF4520E22F7")]
public class IEModule : AddinExpress.IE.ADXIEModule
{
public IEModule()
{
InitializeComponent();
}

private AddinExpress.IE.ADXIEBarItem adxieBarItem1;

public IEModule(IContainer container)
{
container.Add(this);

InitializeComponent();
}

#region Component Designer generated code
/// <summary>
/// Required by designer
/// </summary>
private System.ComponentModel.IContainer components;

/// <summary>
/// Required by designer support - do not modify
/// the following method
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.adxieBarItem1 = new AddinExpress.IE.ADXIEBarItem(this.components);
//
// adxieBarItem1
//
this.adxieBarItem1.BarType = "TestAddon.MyIEBar";
this.adxieBarItem1.MenuText = "adxieBarItem1";
//
// IEModule
//
this.Bars.Add(this.adxieBarItem1);
this.ModuleName = "TestAddon";
this.OnSendMessage += new AddinExpress.IE.ADXIESendMessage_EventHandler(this.IEModule_OnSendMessage);
this.OnConnect += new AddinExpress.IE.ADXIEConnect_EventHandler(this.IEModule_OnConnect);

}
#endregion

#region ADX automatic code

// Required by Add-in Express - do not modify
// the methods within this region

public override System.ComponentModel.IContainer GetContainer()
{
if (components == null)
components = new System.ComponentModel.Container();
return components;
}

[ComRegisterFunctionAttribute]
public static void RegisterIEModule(Type t)
{
AddinExpress.IE.ADXIEModule.RegisterIEModuleInternal(t);
}

[ComUnregisterFunctionAttribute]
public static void UnregisterIEModule(Type t)
{
AddinExpress.IE.ADXIEModule.UnregisterIEModuleInternal(t);
}

[ComVisible(true)]
public class IECustomContextMenuCommands :
AddinExpress.IE.ADXIEModule.ADXIEContextMenuCommandDispatcher
{
}

[ComVisible(true)]
public class IECustomCommands :
AddinExpress.IE.ADXIEModule.ADXIECommandDispatcher
{
}

#endregion

public IE.WebBrowser IEApp
{
get
{
return (this.IEObj as IE.WebBrowser);
}
}

public mshtml.HTMLDocument HTMLDocument
{
get
{
return (this.HTMLDocumentObj as mshtml.HTMLDocument);
}
}

private void IEModule_OnSendMessage(AddinExpress.IE.ADXIESendMessageEventArgs e)
{
if (e.Message == 0x400 + 1000)
{
System.Object one = null;
System.Object two = null;
System.Object three = null;
System.Object four = null;
IEApp.Navigate(@"https://www.somesite.net/member/app/registration", ref one, ref two, ref three, ref four);
}
}

private void IEModule_OnConnect(object sender, int threadId)
{
this.SendMessageToAll(0x400 + 1000, IntPtr.Zero, IntPtr.Zero);
}


}
}
Posted 18 Feb, 2010 22:54:12 Top
Andrei Smolin


Add-in Express team


Posts: 14976
Joined: 2006-05-11
Hi Shawn,

I've tested the same approach in a new IE add-on on Windows XP SP3 + IE 7 + Add-in Express for IE and .NET 5.2.261 + all updates. It works fine. I suggest that you unregister your add-on, clear Bin\Debug and Bin\Release folders of your add-on project, replace Loader\adxloader.dll with {Add-in Express}\Redistributables\adxloader.dll and register your add-on.

Please let me know about your results.

Regards from Belarus (GMT+2),

Andrei Smolin
Add-in Express Team Leader
Posted 19 Feb, 2010 08:56:31 Top
Shawn Fenus




Posts: 16
Joined: 2010-01-08
Andrei,

Thanks for getting back with me.

I tried your suggestion and got a different result but a similar outcome. Again it only happens on some XP Machines running

IE7. This is what is happening now: It no longer comes up with the automated message (Which is good :-) ). But now it is doing the same thing as the the test app I created earlier in this thread - it now pops open a error box that reads :

Internet Explorer cannot open site https://www.somesite.net/member/app/registration.

Operation aborted

Here are the results form 2 machine I am testing on a regular basis. There are a few things different about the machine I can get it to work on and the machine I cannot.

Machine it works on:
Is also a development environment with add-in express plugged in to Visual Studio.
I remote into this machine - No VPN required.

Machine it does NOT work on.
I need a VPN connection to access the machine.
It does not have an Add-In Express developing environment on it.

I appreciate any help you can give me on this. Thanks in Advance.
Posted 22 Feb, 2010 11:08:41 Top
Andrei Smolin


Add-in Express team


Posts: 14976
Joined: 2006-05-11
Hi Shawn,

Please check if the following helps:
1) Apply IEApp.Navigate to "http:\\www.google.com" instead of the page mentioned in your code
2) unregister your add-on, remove the IE bar from the bars collection, open IE, close IE, register the add-on
3) make sure that you IE opens a single tab ("about:blank") when you start it.

Regards from Belarus (GMT+2),

Andrei Smolin
Add-in Express Team Leader
Posted 22 Feb, 2010 12:00:39 Top
Shawn Fenus




Posts: 16
Joined: 2010-01-08
Thanks for the quick reply Andrei

When I do this(remove the IE bar from the bars collection) I lose the reference to my side bar and I get a compilation error indicating I do not have a definition for my sidebar. Sorry if I am I misunderstanding what you mean by remove the IE bar from the bars collection?
Posted 22 Feb, 2010 12:29:25 Top