Attempted to read or write protected memory. This is often an indication that other memory has been corrupted

Rate It (1)

Last post 11-05-2009 4:38 PM by DBMaster. 25 replies.

Sort Posts:

  • Attempted to read or write protected memory. This is often an indication that other memory has been corrupted

    08-25-2004, 6:40 AM
    • Member
      669 point Member
    • wesleymichel
    • Member since 04-06-2003, 6:27 AM
    • Paris, France
    • Posts 153
    Hi

    For to train with ASP.NET V2 , I have to migrate an web application.

    It's picture galery.

    But sometimes I have got this errors :


    Attempted to read or write protected memory. This is often an indication that other memory has been corrupted.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory has been corrupted.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:


    [AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory has been corrupted.]
    System.EventHandler.Invoke(Object sender, EventArgs e) +0
    System.Web.UI.Control.OnLoad(EventArgs e) +87
    System.Web.UI.Control.LoadRecursive() +66
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2835




    --------------------------------------------------------------------------------
    Version Information: Microsoft .NET Framework Version:2.0.40420.0; ASP.NET Version:2.0.40420.0




    Thanks for your help.



  • Re: Attempted to read or write protected memory. This is often an indication that other memory has been corrupted

    09-02-2004, 5:31 PM
    • Member
      230 point Member
    • gstasa
    • Member since 06-11-2002, 12:29 PM
    • Posts 44
    • AspNetTeam
    Hi,

    Are you using any custom controls? Can you please get the full stack trace (e.g. view->source in the browser menu when requesting the page locally)?

    The error often indicates an AV in unmanaged code that your app might be calling into..

    thanks
    Gjergji
    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: Attempted to read or write protected memory. This is often an indication that other memory has been corrupted

    12-23-2006, 12:04 AM
    • Member
      4 point Member
    • blbirajdar
    • Member since 12-23-2006, 5:03 AM
    • Posts 2

    Your problem is genuine. And since it is problem , it has a soluton too. The solution lies with you ;only you need to look at it in a different view. I have faced the similar problem  and took me weeks to solve it.

    The main cause behind it lies to the highly enhanced security features of .NET framework 2.0 over .NET 1.1. It has imposed several restiction , policies and permission sets for accessing the data from the web application, It uses full trust as well as partial trust.

    1)  If you try to access the data you don't have permission too or if the source is not trusted it gives the above exception. You not only have to give permission to your application to access the source BUT  you need to make the source as trusted one too.

    2)Also, the other main cause is that , if you try to read the data that is not available, it gives the above exception.

    So its time now to revise your concepts about CAS and permissions in visual studio.NET 2005 which is highly advanced than .NET 1.1.

     For details click the link  below http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/foundstone.asp

    Go thro it docs and decide which permission your application requires and implement it.

    Best of Luck.

    mail me a thank you if you are benefitted by this post.

    Balaji Birajdar

     

    Balaji Birajdar
    Software Engineer, Pune
  • Re: Attempted to read or write protected memory. This is often an indication that other memory has been corrupted

    04-19-2007, 6:16 AM
    • Member
      6 point Member
    • veena_ramdas
    • Member since 04-18-2007, 5:26 AM
    • Posts 3
    I had got this error message when i was trying to retrieve the servername from the ini file through GetPrivateProfileString. But then i had rights to the file. Cant understand wat the problem is. Kindly help.
  • Re: Attempted to read or write protected memory. This is often an indication that other memory has been corrupted

    05-30-2007, 6:47 AM
    • Member
      2 point Member
    • Dmitry Gresev
    • Member since 05-30-2007, 9:48 AM
    • Minsk, Belarus
    • Posts 1

    We've got the same exception ("Attempted to read or write protected memory. This is often an indication that other memory has been corrupted.") after we have migrated our ASP.NET application from Framework 1.1 to 2.0. The error occurs when application calls method from external DLL written in C++. DLL itself works with file systems and COM objects (such as Word Automation object).

    We have tested different options. For the moment:

    1) Application is impersonated - aspnet_wp.exe is launched under user account with administrative rights.

    2) This user account has Full Control permission on all affected files and folders as well as on used COM objects.

    3) As suggested on other forums, compiler optimisation is turned off.

    4) All methods in C# class which call methods from DLL are marked with [SecurityPermission(SecurityAction.Assert, Unrestricted = true)] attribute.

    But anyway we've got "Attempted to read or write protected memory. This is often an indication that other memory is corrupt." exception at a certain method call. On ASP.NET 1.1 everything works fine. Does anybody have any idea how to solve the issue?

  • Re: Attempted to read or write protected memory. This is often an indication that other memory has been corrupted

    06-12-2007, 9:52 PM
    • Member
      2 point Member
    • philipd
    • Member since 06-13-2007, 1:50 AM
    • Posts 1

    Hi Dmitry,

    Did you figure this out? We have the same exact issue and would love to hear the solution?

    Thanks,

    - Phil.

  • Re: Attempted to read or write protected memory. This is often an indication that other memory has been corrupted

    07-03-2007, 12:05 PM
    • Member
      89 point Member
    • brianphilpot
    • Member since 07-24-2002, 10:29 AM
    • Posts 19

    I was getting this same exact message. Cryptic.

    The error came up when my aspx page attempted to execute an OleDBCommand against Oracle 10g client.

    Then I realized that I was missing the command parameter that was specified in the query.

    Looks like instead of giving you a pretty message, you get this ugly one.

    Hope This Helps,
    Brian

  • Re: Attempted to read or write protected memory. This is often an indication that other memory has been corrupted

    07-10-2007, 1:39 PM
    • Member
      2 point Member
    • sam_de_diacre
    • Member since 07-10-2007, 5:37 PM
    • Posts 1

     

    Hi Dmitry and philipd,

    I also have the same problem of my aplication calling a DLL, do you by that time solved the problem?

    regards,

    Sami

  • Re: Attempted to read or write protected memory. This is often an indication that other memory has been corrupted

    07-26-2007, 11:28 AM
    • Member
      6 point Member
    • gogliogi
    • Member since 07-26-2007, 3:24 PM
    • Posts 3

    Hi guys,

    did you try to use Microsoft driver for OLE (MSDAORA) instead of Oracle driver ?

    it solved the issue for me:

     Gogliogi

     

  • Re: Attempted to read or write protected memory. This is often an indication that other memory has been corrupted

    07-27-2007, 3:01 AM
    • Member
      6 point Member
    • gogliogi
    • Member since 07-26-2007, 3:24 PM
    • Posts 3

    Microsoft also released a hotfix (July 2nd, 2007) to prevent the error "Attempted to read or write protected memory" that has been plaguing the .NET 2.0 platform for some time now.

    But it did NOT worked in my case.


    The hotfix can be downloaded from http://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=6003

    Gogliogi

  • Re: Attempted to read or write protected memory. This is often an indication that other memory has been corrupted

    08-06-2007, 9:45 AM
    • Member
      2 point Member
    • jagsmcp
    • Member since 05-21-2007, 10:08 AM
    • Posts 1

    Did you got any clue of the prob as i am facing the same?

  • Re: Attempted to read or write protected memory. This is often an indication that other memory has been corrupted

    08-20-2007, 4:19 AM
    • Member
      6 point Member
    • gogliogi
    • Member since 07-26-2007, 3:24 PM
    • Posts 3

    Only that I personally experienced that Oracle OLE DB driver doesn't work with NET Framework 2.0, while MSDAORA interacts correctly.

    I spent a week trying every trick to use Oracle driver, then I changed to Microsoft driver. It works in my environment.

    Gogliogi

  • Re: Attempted to read or write protected memory. This is often an indication that other memory has been corrupted

    10-24-2007, 1:06 PM
    • Member
      234 point Member
    • formationusa
    • Member since 04-04-2006, 2:53 PM
    • Morocco
    • Posts 48

    Hello everyone,

     check this link out. I'm using Telerik components. doing what they said in the forum solved this problem for me.

    http://www.telerik.com/support/kb/article/b454K-dgg-b454T-cdb.aspx

     Regards

    Dinia Oussama
    http://oudinia.blogspot.com
  • Re: Attempted to read or write protected memory. This is often an indication that other memory has been corrupted

    10-30-2007, 11:24 AM
    • Member
      2 point Member
    • rouxmohammed
    • Member since 10-30-2007, 3:18 PM
    • Posts 1
    I was getting same error, when I was trying to drop telerik control onto page.Deleted solution and source control solution files off my local machine and got latest from VSS. Bingo!Party!!!

     

  • Re: Attempted to read or write protected memory. This is often an indication that other memory has been corrupted

    06-04-2008, 3:09 AM

     If anybody getting the above mentioned error while running database query from .net, then please check the query/oledb command parameter type/values/order of oledb parameters properly...most of the times i faced the above exception because these werent proper.... Just instead of giving proper message it throws wiered message of "memory.."...

Page 1 of 2 (26 items) 1 2 Next >