Last post Jul 11, 2009 01:50 PM by whighfield
Jul 10, 2009 10:52 AM|smehaffie|LINK
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 dedicated on this site for using System.Drawing in ASP.Net applications. Plus, all the 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.
system.drawing exceptions asp.net
A generic error occurred in GDI+
Jul 11, 2009 01:50 PM|whighfield|LINK
Has anyone else has this issue when using System.Drawing in an ASP.Net application? If so, what was the fix.
This just does not seem right since there is a whole forum dedicated on this site for using System.Drawing in ASP.Net applications.
You may want to check out the System.Windows.Media.Imaging Namespace (shipped with the WPF .NET 3.0 library) and see if you can use something in there. This library is supported under asp.net.