Click to See Complete Forum and Search --> : Embedding Mozilla in c#: Browser is not in a valid state


EricBlair
09-26-2007, 01:20 PM
Hi,

New to mozilla embedding. In .Net C# I have an app that loads the
browser when I place it in a new form and it runs.

But I want to load the browser as a Browser (in the native browser
window) when I try to do this:

AxMozillaBrowser BrowserApp=new AxMozillaBrowser();
BrowserApp.Navigate("http://www.somesite.com");

I get this error:
Exception of type 'System.Windows.Forms.AxHost
+InvalidActiveXStateException' was thrown.

If I try this:
MozillaBrowser BrowserApp=new MozillaBrowser();
BrowserApp.Navigate("http://www.somesite.com", ref o, ref o, ref o,
ref o);

I get this error:
Browser is not in a valid state

System.Runtime.InteropServices.COMException was unhandled
Message="Browser is not in a valid state"
Source="Mozilla.Browser.1"
ErrorCode=-2147418113
StackTrace:
at MOZILLACONTROLLib.MozillaBrowserClass.Navigate(String URL,
Object& Flags, Object& TargetFrameName, Object& PostData, Object&
Headers)
at SimpleBrowser.SimpleBrowser.Main() in C:\MozBrowser
\MozBrowser.cs:line 30
at System.AppDomain.nExecuteAssembly(Assembly assembly,
String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile,
Evidence assemblySecurity, String[] args)
at
Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object
state)
at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

I must be missing some initialization call, I don't what it is.

Anyone here done this successfully and have any tips?

Thanks!