J
Johny_W
hi guys,
I have encountered a problem with IE automation (.NET 2.0, C#, mshtml,
SHDocVw). I am writing a class for manipulating specific html pages
with frames. It is supposed to be used from a web service. The
problem is that when I use the InternetExplorer object in web service,
it seems like the underlying IE doesn't support frames. When I try to
access HTMLDocumentClass.frames property I get the following exception:
Specified cast is not valid.
at System.RuntimeType.ForwardCallToInvokeMember(String memberName,
BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData&
msgData)
at mshtml.HTMLDocumentClass.get_frames()
at myclass.mymethods()
the code lines, that cause the exception:
ie = new InternetExplorer();
object dummy = null;
ie.Navigate("myurl", ref dummy, ref dummy, ref dummy, ref dummy);
// ... omitted code assuring the html document is loaded ...
HTMLDocumentClass iedoc = (HTMLDocumentClass)ie.Document;
FramesCollection frames = iedoc.frames; // this throws the exception
....
(when the same code is used in a "normal" windows forms application, it
works fine).
I have encountered a problem with IE automation (.NET 2.0, C#, mshtml,
SHDocVw). I am writing a class for manipulating specific html pages
with frames. It is supposed to be used from a web service. The
problem is that when I use the InternetExplorer object in web service,
it seems like the underlying IE doesn't support frames. When I try to
access HTMLDocumentClass.frames property I get the following exception:
Specified cast is not valid.
at System.RuntimeType.ForwardCallToInvokeMember(String memberName,
BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData&
msgData)
at mshtml.HTMLDocumentClass.get_frames()
at myclass.mymethods()
the code lines, that cause the exception:
ie = new InternetExplorer();
object dummy = null;
ie.Navigate("myurl", ref dummy, ref dummy, ref dummy, ref dummy);
// ... omitted code assuring the html document is loaded ...
HTMLDocumentClass iedoc = (HTMLDocumentClass)ie.Document;
FramesCollection frames = iedoc.frames; // this throws the exception
....
(when the same code is used in a "normal" windows forms application, it
works fine).