Accessing a HTML document in a resouce dll

T

thompson_38

I am currently working on a C# application that uses an axWebBrowser
control which displays HTML pages. This is being done to reuse an
existing web application which resides on a client's computer. I
have created a resource .dll linking in all of the HTML, images and
JavaScript pages in the old project. Using the
res://mydll/homepage.htm, the home page loads into the web browser
control (axWebBrowser.Navigate). This page has frameset, so when I try
to access the document frames, I get an exception Access Denied.

I am using code similar to this to access the frames:

HTMLDocument myDoc = new HTMLDocumentClass();
myDoc = (HTMLDocument) axWebBrowser1.Document;
FramesCollection c = myDoc.frames;

Object o = i;
i++;
Object c1 =null;

try
{
c1 = c.item(ref o);
}
catch(Exception ex)
{
Console.WriteLine(ex.Message)
}

Is this a way that I can dynamically change the frames depending on a
users action. I have no problem displaying the frames or using the
JavaScript when they are not in a resource dll. If there a different
technique, using the Document and JavaScript when they are contained in
a resource dll.

Thank you in advance for all of your time.
 
N

Nicholas Paldino [.NET/C# MVP]

How are you packaging the documents as a resource in the dll? The way
that .NET handles resources and the way that the web browser control expects
them are different.
 
T

thompson_38

If I am answering your question correctly, I am building a C++ resource
library, I have added all of the HTML/JavaScript in the .rc file under
the HTML tag as follows


TIPS.HTM HTML "tips.htm"
HELP.HTML HTML "help.htm"
TIPS.JS HTML "tips.js"
STYLE.CSS HTML "style.css"


How are you packaging the documents as a resource in the dll? The way
that .NET handles resources and the way that the web browser control expects
them are different.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

thompson_38 said:
I am currently working on a C# application that uses an axWebBrowser
control which displays HTML pages. This is being done to reuse an
existing web application which resides on a client's computer. I
have created a resource .dll linking in all of the HTML, images and
JavaScript pages in the old project. Using the
res://mydll/homepage.htm, the home page loads into the web browser
control (axWebBrowser.Navigate). This page has frameset, so when I try
to access the document frames, I get an exception Access Denied.

I am using code similar to this to access the frames:

HTMLDocument myDoc = new HTMLDocumentClass();
myDoc = (HTMLDocument) axWebBrowser1.Document;
FramesCollection c = myDoc.frames;

Object o = i;
i++;
Object c1 =null;

try
{
c1 = c.item(ref o);
}
catch(Exception ex)
{
Console.WriteLine(ex.Message)
}

Is this a way that I can dynamically change the frames depending on a
users action. I have no problem displaying the frames or using the
JavaScript when they are not in a resource dll. If there a different
technique, using the Document and JavaScript when they are contained in
a resource dll.

Thank you in advance for all of your time.
 
T

thompson_38

I have been unsuccessful in finding information pertaining to this
subject, anyone have an idea?

thompson_38 said:
If I am answering your question correctly, I am building a C++ resource
library, I have added all of the HTML/JavaScript in the .rc file under
the HTML tag as follows


TIPS.HTM HTML "tips.htm"
HELP.HTML HTML "help.htm"
TIPS.JS HTML "tips.js"
STYLE.CSS HTML "style.css"


How are you packaging the documents as a resource in the dll? The way
that .NET handles resources and the way that the web browser control expects
them are different.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

thompson_38 said:
I am currently working on a C# application that uses an axWebBrowser
control which displays HTML pages. This is being done to reuse an
existing web application which resides on a client's computer. I
have created a resource .dll linking in all of the HTML, images and
JavaScript pages in the old project. Using the
res://mydll/homepage.htm, the home page loads into the web browser
control (axWebBrowser.Navigate). This page has frameset, so when I try
to access the document frames, I get an exception Access Denied.

I am using code similar to this to access the frames:

HTMLDocument myDoc = new HTMLDocumentClass();
myDoc = (HTMLDocument) axWebBrowser1.Document;
FramesCollection c = myDoc.frames;

Object o = i;
i++;
Object c1 =null;

try
{
c1 = c.item(ref o);
}
catch(Exception ex)
{
Console.WriteLine(ex.Message)
}

Is this a way that I can dynamically change the frames depending on a
users action. I have no problem displaying the frames or using the
JavaScript when they are not in a resource dll. If there a different
technique, using the Document and JavaScript when they are contained in
a resource dll.

Thank you in advance for all of your time.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top