locked
Drawing (GDI+) in a control with a custom HttpHandler RRS feed

  • Question

  • User1224976752 posted
    Hello, I'm making some own kind of charting control which will be drawn with GDI+. For drawing the graphics I'm using an implementation of the IHttpHandler which sends back the graphics. Yesterday I had never heard of HttpHandlers, so sorry if I'm asking something weird :o My control is based on the sample which is in the "Developing Microsoft ASP.NET Server Controls and Components" book. The basic idea is this: In the control there are 2 classes: - myControl which is inherited from "Image" and which contains al the properties for the control. - myHandler which implements IHttpHandler and is responsible for rendering the graphics. Works great but it gots 1 disadvantage. For using the control in a project you have to make some .ashx file with a webhandler to the myHandler class and then set the imageurl of the control to this .ashx page. Of course there is nothing wrong with this, but actually I don't like bothering the people who use my control with making some ashx file. So my question is, is it possible to do get rid of making that .ashx file for the users of my control?
    Tuesday, January 6, 2004 6:43 AM

All replies

  • User-1030800308 posted
    I don't think so, since you need to make sure ASP.NET hands off the request to your httphandler. What I've seen some Charting controls do instead is generate temporary files on a folder and hand out paths to those instead, and create a secondary thread that periodically cleans up the temporary files...
    Tuesday, January 6, 2004 12:21 PM
  • User1356982465 posted
    Just create a class that implements IHttpHandler and then configure it with a fake url in web.config with an extension mapped to ASP.NET is IIS. <system.web> <httpHandlers> <add verb="*" path="FakeUrl.aspx" type="Namespace.Class, Assembly" /> </httpHandlers> </system.web>
    Tuesday, January 6, 2004 7:24 PM
  • User1224976752 posted
    Great, exacly what I was looking for. thank you Paul!
    Wednesday, January 7, 2004 12:50 PM