Web User Controls: A GIF in resx

  • Thread starter Thread starter kurt sune
  • Start date Start date
K

kurt sune

I have made an user control for a header for all web pages.

Now I want to add an image in the header.

What is the best way of embedding a GIF in the usercontrol?

I donot want to distribute the image separately from the usercontrol.

Put the gif in the resourcefile?
Other options?

/k
 
kurt said:
I have made an user control for a header for all web pages.

Now I want to add an image in the header.

What is the best way of embedding a GIF in the usercontrol?

I donot want to distribute the image separately from the usercontrol.

Put the gif in the resourcefile?
Other options?

/k

You can't just embed an image in the html-stream, images are always
requested by the server in a separate request.
The html-source just contains an <img> tag with a "src" attribute
pointing somewhere. The browser reacts to this by sending a separate
request for the url in that src attribute.

So if you don't want to have a separate file, you will have to provide some
other means to get at that image. This usually means that you need
a separate aspx or an http-handler (or in general: some url that will
provide that image -- which can then come from some other place on the
filesystem, a database or a resource file).

Hans Kesting
 
I need more Information !

Sure, you can put it into a directory and that's it!
Or into a resource file!

But it's also possible to save it as BLOB into a database - you should do
this when there's a possibility to change the bitmap from the ASPX.
 
Do you think it would be feasible to store a GIF in a resource file in a web
custom control and in the render method stream out a string like this
"<DIV id="header2" style="Z-INDEX: 103" ms_positioning="GridLayout"><IMG
style="Z-INDEX: 101" src="Logo.gif"></DIV>

and replace the file name with a bitstream?

/k
 
kurt said:
Do you think it would be feasible to store a GIF in a resource file
in a web custom control and in the render method stream out a string
like this "<DIV id="header2" style="Z-INDEX: 103"
ms_positioning="GridLayout"><IMG style="Z-INDEX: 101"
src="Logo.gif"></DIV>

and replace the file name with a bitstream?

/k

No, you can *not* replace that url with a bitstream. The html source-code
and the image data are two separate responses to two separate requests
of the browser.
 
Back
Top