We are using System.Drawing in and application to manipulate images in a web application (rotate, flip, etc). For the last month we have been getting the following error very sporadically.
"Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
Based on the MSDN Library it appears that we should not be using System.Drawing in our web application (see insert below).
Classes within theSystem.Drawing.Imaging namespace are not supported for use within a Windows or ASP.NET service. Attempting to use these classes from within one of these application types may produce unexpected problems, such as diminished service performance and run-time exceptions.
This just does not seem right since there is a whole forum on ASP.Net for using System.Drawing in ASP.Net applications. Plus, all the web Image Editor controls I have found use Sytem.Drawing, so that is another reason I am thinking it is not really an issue with System.Drawing. So the questions I have are:
1) Has anyone else has this issue when using System.Drawing in an ASP.Net application? If so, what was the fix.
2) The line that throws the error is below, could the issue be that we are using a MemoryStream and not really an issue with System.Drawing? Would using a different type of stream take care of the issue.
using (System.Drawing.Image oFullImg = System.Drawing.Image.FromStream(msImage))
3) If there really is a problem and we should not be using System.Drawing, what other alternatives are there for manipulating images on a web site.
This is becoming a more critical issue as it drags on, so the quicker I can find a solution the better. Any help will be appreciated.