I have a project where I am required to embed a few images and CSS files in
the assembly (v1.1) and read them out at runtime. I know that this can be
done using an HttpHandler/.axd file (like the one used for FreeTextBox http://www.freetextbox.com), but I've never tried this before. Does anyone
have any sample code for this? I know they've made this much easier in 2.0.
--
Grant Harmeyer 2 1401
This is a code that outputs static image from a array.
It's a regular aspx page and called like this <img src="renewSes.aspx">
You should be able easily modify it to output from resource file
George.
public class renewSes : System.Web.UI.Page
{
static byte [] gif =
{0x47,0x49,0x46,0x38,0x39,0x61,0x01,0x00,0x01,0x00 ,0x91,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ,0x00,0x00,0x00,0x00,0x00,0x21,0xf9,0x04,0x09,0x00 ,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0x00,0x01,0x00 ,0x01,0x00,0x00,0x08,0x04,0x00,0x01,0x04,0x04,0x00 ,0x3b,0x00};
override protected void OnInit(EventArgs e)
{
Response.AddHeader("ContentType", "image/gif");
Response.Cache.SetCacheability(HttpCacheability.No Cache);
Response.BinaryWrite(gif);
Response.End();
}
}
"Grant Harmeyer" <ne*@internetapollo.com> wrote in message
news:uK**************@tk2msftngp13.phx.gbl... I have a project where I am required to embed a few images and CSS files in the assembly (v1.1) and read them out at runtime. I know that this can be done using an HttpHandler/.axd file (like the one used for FreeTextBox http://www.freetextbox.com), but I've never tried this before. Does anyone have any sample code for this? I know they've made this much easier in 2.0.
-- Grant Harmeyer
Yes, but that still doesn't use an HttpHandler to read the image or CSS from
the assembly as an embedded resource. For example, the FreeTextBox
WebControl has all of the images and such embedded into the assembly. Then
when the page is rendered, the webpage references the images like so:
<img
src="FtbWebResource.axd?a=FreeTextBox%2c+Version%3 d3.1.5000.0%2c+Culture%3dneutral%2c+PublicKeyToken %3d5962a4e684a48b87&r=FreeTextBoxControls.Resource s.Images.OfficeMac.superscript.gif&t=6327271985427 27578"
/>
I would like to reference the images and CSS files that I use for themes to
be referenced in the same way.
"George Ter-Saakov" <gt****@cardone.com> wrote in message
news:e9*************@TK2MSFTNGP11.phx.gbl... This is a code that outputs static image from a array. It's a regular aspx page and called like this <img src="renewSes.aspx"> You should be able easily modify it to output from resource file
George.
public class renewSes : System.Web.UI.Page {
static byte [] gif = {0x47,0x49,0x46,0x38,0x39,0x61,0x01,0x00,0x01,0x00 ,0x91,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ,0x00,0x00,0x00,0x00,0x00,0x21,0xf9,0x04,0x09,0x00 ,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0x00,0x01,0x00 ,0x01,0x00,0x00,0x08,0x04,0x00,0x01,0x04,0x04,0x00 ,0x3b,0x00};
override protected void OnInit(EventArgs e)
{
Response.AddHeader("ContentType", "image/gif");
Response.Cache.SetCacheability(HttpCacheability.No Cache);
Response.BinaryWrite(gif);
Response.End();
}
}
"Grant Harmeyer" <ne*@internetapollo.com> wrote in message news:uK**************@tk2msftngp13.phx.gbl...I have a project where I am required to embed a few images and CSS files in the assembly (v1.1) and read them out at runtime. I know that this can be done using an HttpHandler/.axd file (like the one used for FreeTextBox http://www.freetextbox.com), but I've never tried this before. Does anyone have any sample code for this? I know they've made this much easier in 2.0.
-- Grant Harmeyer
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Philipp Seidel |
last post by:
Hi there!
I did not know, where this topic fits in, so I put it here.
I have a minor problem with embedded resources, which puzzles me quite a
lot. I'd be glad if anyone can help me on this:
...
|
by: Drew |
last post by:
Assembly asm = Assembly.GetExecutingAssembly();
me = new Bitmap(asm.GetManifestResourceStream("me.gif"));
I have used this before without any problem, but now I get:
An unhandled exception...
|
by: Chris Schremser |
last post by:
I have a question regarding embedded controls in IE. We are looking to
replace a small VB ActiveX control with something written in C#. We have
written the control and it instantiates correctly...
|
by: Kyle Kaitan |
last post by:
I have an assembly (AppResources.dll) which contains a number of embedded
resource files. Most of these are key/value pairs of relevant strings; a few
are images and sounds; some more are XML...
|
by: Wysiwyg |
last post by:
Is there any way to add an embedded resource to a project without copying it
to the project's directory? I have shared resources and don't want each
project using the images, xml files, etc. to...
| |
by: Jon Rista |
last post by:
I have a project where I need to create a windows .exe by compiling code and
linking in some resources. This program thats being generated is somewhat
unconventional, and I'll explain how. I'm...
|
by: Johann Blake |
last post by:
I'm having trouble grasping how ASP.NET correctly locates resources.
There is plenty of documentation on this subject but some things are
not clear at all.
In my ASP.NET application, I have...
|
by: Bob Rock |
last post by:
Hello,
I'd like to programmatically access keys and values of on .resources file
embedded in my assembly.
I've seen that the assembly class provides the GetManifestResourceStream
method .......
|
by: Fred* |
last post by:
Hello,
I'm using Visual C# 2005 Express.
if I create a new "application windows" project and run it (F5), it works
well. (an empty window is launched..)
as soon as I set the build action to...
|
by: Frinavale |
last post by:
I am attempting to use embedded resources in an Ajax Enabled ASP.NET Web Application. I'm using Visual Studio 2008 and VB.NET server side code.
The project is called "EmbeddedResources" with the...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |