Embedding ASPX pages are resources

P

Praveen

Hi,

I have a control that currently embeds it's images and script files as
resources (by marking them as 2.0's WebResourceAttribute) and lets the
runtime handle the streaming of the files to the client.

This control now also uses a html file (which gets used as a "dialog" during
runtime) and I would like to embed this html file as an assembly resource
(just like the above images and scripts) to help make deploying my control's
assembly much easier. Is that possible? How do I go about doing that?

Thanks
Praveen
 
S

Steven Cheng[MSFT]

Hi Praveen,

Welcome to the ASPNET newsgroup.

As for the let custom webcontrol display a dialog which pointed to an
embeded htm page in our custom control's assembly, I think it is the same
with embeding other kind of resources. We just need to embed the htm file
in our control's assembly, register with the [assembly:WebResource]
attribute, and then, use hte Page.ClientScript.GetWebResourceUrl method to
get the runtime dynamic url of that embeded htm file. e.g:

[assembly: WebResource("ControLibrary.Resources.dlg.htm", "text/html")]


protected override void RenderContents(HtmlTextWriter output)
{
output.Write("<br/><a href=\"" +
Page.ClientScript.GetWebResourceUrl(this.GetType(),
"ControLibrary.Resources.dlg.htm") + "\" >New Page</a>");


}

this help output a hyperlink which point to the embeded html page. You can
also use some scripts to display a new dialog window which point to the
embeded html file.

Hope this helps.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
P

Praveen

Steven,

Thanks for the response. I actually meant to say that the embedded file is a
ASPX file (not htm file). So, you think it would still work?

Will the asp.net runtime still get a crack at processing the embedded aspx
file link before it gets sent to the client via 2.0 installed http handlers
(for resource retrieval)?

Thanks
-Praveen
 
S

Steven Cheng[MSFT]

Thanks for your response Praveen,

I'm afraid ASPX content won't work for such scenario, the embeded resource
should be static text data since they'll not be processed by the ASP.NET
runtime engine.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
Joined
Aug 4, 2006
Messages
1
Reaction score
0
I hope someone will read this thread :). Well if you say we cannot embed aspx pages, what do you think how will the static html page get images from embedded resources
 

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

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,131
Latest member
IsiahLiebe
Top