Dynamic images from a class library

N

Nathan Sokalski

I am creating a class library for ASP.NET Web Applications, and I want too
include classes that can be used as dynamic images. I know how to do this in
Web Applications by using an *.aspx file by setting the ContentType
property. However, because the only file that is available in a class
library once it is compiled is the *.dll assembly (when you give a class
library to someone, this is generally only file they should need to deal
with). The two things I need to figure out how to do are:


1. Specify what class in the assembly should return an image

2. Pass arguments the way you pass arguments to an ASP.NET Page. For
example, on my personal site I use:

RoundEdgeButton.aspx?buttontext=TextGoesHere

I have seen places in Windows where arguments are passed to *.dll files, and
I am wondering if there is a way to do something similar with ASP.NET. My
basic goal here is to be able to create any utilities I use on my site
without creating a Page for something that simply returns an image. If
someone could help me here, I would greatly appreciate it. Thanks.
 
H

Hans Kesting

Nathan Sokalski submitted this idea :
I am creating a class library for ASP.NET Web Applications, and I want too
include classes that can be used as dynamic images. I know how to do this in
Web Applications by using an *.aspx file by setting the ContentType property.
However, because the only file that is available in a class library once it
is compiled is the *.dll assembly (when you give a class library to someone,
this is generally only file they should need to deal with). The two things I
need to figure out how to do are:


1. Specify what class in the assembly should return an image

2. Pass arguments the way you pass arguments to an ASP.NET Page. For example,
on my personal site I use:

RoundEdgeButton.aspx?buttontext=TextGoesHere

I have seen places in Windows where arguments are passed to *.dll files, and
I am wondering if there is a way to do something similar with ASP.NET. My
basic goal here is to be able to create any utilities I use on my site
without creating a Page for something that simply returns an image. If
someone could help me here, I would greatly appreciate it. Thanks.

I don't think you should use a URL that points directly into some dll.
Instead use something like this:
* have one generic handler (ashx?) that accepts at least some
"imagecode" parameter
* inside that handler, translate that imagecode into a class to use
(through a configuration file that lists classname+assembly for each
imagecode)
* have that class implement a specific interface
* create an instance of that class, call the method specified by the
interface and pass the other querystring values into it
* return the resulting image to the browser

Hans Kesting
 

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,994
Messages
2,570,222
Members
46,810
Latest member
Kassie0918

Latest Threads

Top