views:

16

answers:

1

I am generating a System.Drawing.Bitmap on the fly in an ASP.NET Custom Web Server Control, and then I want to serve this bitmap as part of the WebResource, because I do not want to save it on the hosting computer.

Is there a way to instruct ASP.NET to serve the generated System.Drawing.Bitmap as part of it's WebResource? (therefore making it an "Embedded Resource")

+2  A: 

Use an HTTP Handler. The handler is basically a piece of code executed when a resource with a specified extension is requested from your server. Since you want a dynamically generated image, you would do that in the code for the handler and return it as a response. Embedding wouldn't work, because you can only embed static information. Here are some links:

Slavo
+1 Excellent, exactly what I wanted. Thank you for correcting me as regards the issue.I used the following article to solve my problem: http://www.codeproject.com/KB/custom-controls/CaptchaControl.aspx
Andreas Grech