This Image Generating thing...

L

Lars Netzel

Hey!

I wrote a message yersterday and got some good answers and have now managed
to generate a nice image. The problem is that it's all generated in an
Images.Aspx file and I don't really want that. I am writing a WebControl
Library and I want to generate everything from there...

In the Render Sub of the Control I output some HTML and there I need to
reference to a file in the <img> element, is there anyway to NOT have to
point to a aspx file (that generated the picture) there and instead point to
a more local way that I can include in my WebControl Library?

I guess it's possible to render the image as a file and put on the
serverdisk and then point to it but that would be a security risk I guess
and can't really asume, that people that would use this control, like to set
permissions on the server to make it work.

How do I do this?

best regards/
Lars Netzel
 
S

Steve Lutz

If I am correct, you want to create a WebControl that creates an image AND
includes the <img=>... tags when rendered, correct?

You COULD put the binary image inline, but I would not recomend that.

From a browser's point of view an img tag creates another request to the
server to grab the image. So you would need 2 controls/pages:
1) The image creation page, which it looks like you aready have
(images.aspx)
2) The web control which renders the <img> tag.

The webcontrol will render something like "<img
src="/images.aspx?parameters" height=x width=x/>"
When the browser then gets this HTML, it will call up /images.aspx to grab
the actual image.

That's the most straight forward way of doing it that I can think of off
hand.

Steve
 
L

Lars Netzel

Okay! Thanx, I was afraid of that that was the only way. The thign is I've
seen really cool Chart Controls for the web that renders 3d illustrations
using GDI+ and since they cost a lot I asume they have protected the code
for the image rendering and if it is like you say.. that you can only render
the image from an aspx file.. the code is pretty much open to all... and
also a bit harder to distribute, the user will need to add the aspx file to
his projects.. I wanted to see if it's possible to make a ONE dll solution
for the solution that would incluse all the pictures and just work.

What's your thoughts on this?

/Lars
 
K

Kevin Spencer

Hi Lars,

First, if your ASP.Net code is pretty much open to all, you have a SERIOUS
security hole on your web server!

Second, you must understand that in a web page, an image is requested via a
URL. Now, you could always write a custom HTTP handler that handles the
image request, but you will still have to have a URL that the HTTP handler
can respond to. It is actually much simpler (and just as secure) to do it
the easy way, and write an ASPX page that serves up the image.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.
 
G

gerry

they are mapping the requested images to an image generating service on the
server ( ie. rewriting xxx.png as ImageGen.aspx?xxx )
 
K

Kevin Spencer

I've given you the basics. There are several ways to achieve this, one of
which I mentioned: a custom HTTP Handler. With a custom HTTP Handler, you
could use any file extension you like. However, as I said, that isn't
necessary in your case, and would probably be much more difficult for you to
implement, or you wouldn't have to ask.

If I was steering you wrong, believe me, somebody would have told you by
now! ;-)

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.
 
L

Lars Netzel

I appriciate you answers and your time spent on this thread. I just wanted
to see if there were other options than using an aspx file as image source.

I guess we'll wait until asp.net 2.0 and see what the DynamicImage control
can achieve!

/Lars
 
L

Lars Netzel

okey, thanx, so they are also in need of an "online" service for the
picture, might not be a local "kick ass" solution that I thought.

/Lars
 

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,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top