Finally got the code I’ve been working on for…

less than 1 minute read

Finally got the code I’ve been working on for the last few weeks all hooked up together so that I have some ASP.NET pages calling into my class libraries, which are written in a mixture of C#, VB.NET, and managed C++. This works great, and the code separation compared to straight ASP makes maintenance much easier.

One thing I did find out, that didn’t appear to be documented on MSDN, was that when you call the Image.Save method, some ImageFormat’s need the output stream to be able to seek and others don’t. For example, the ImageFormat.JPEG version seemed quite happy to write directly to the ASP.NET Response.OutputStream. For PNG, however, I had to write to a MemoryStream and then copy the contents to the Response.OutputStream afterwards. The error message wasn’t particularly helpful, giving an interop exception with GDI+. Oh well, problem solved now.

Updated: