Attempted to read or write protected memory. This is often an indication that other memory is corrup [Resolved]

Posted by Vuyiswamb under Silverlight on 6/3/2011 | Points: 10 | Views : 5958 | Status : [Member] [MVP] [Administrator] | Replies : 1
Good Day All

i have an application that i use to test my example. i am creating a Cookie in Silverlight and access the Cookie in In my example application works fine. The code for creating a Cookie is like this

private void SetCookies(string name, string value)
// Call the SetCookie(name,value) JavaScript method
string code = string.Format("document.getElementById('myIFrame').contentWindow.SetCookie('{0}','{1}')", name, value);

and in my Page load of the Silverlight Page i have this

HtmlElement iframe = (HtmlElement)radHtmlPlaceholder1.HtmlPresenter.Children[0];
// Set an ID to the IFrame so that can be used later when calling the javascript
iframe.SetAttribute("id", "myIFrame");

I am using it this way because i want to access a Cookie or a Value from Silverlight in The Element "RadhtmlplaceHolder1" is a telerik control that is being used as described here
i will not go to the aspx page where the Cookie is being accessed, but the problem comes when setting it in this line


Attempted to read or write protected memory. This is often an indication that other memory is corrupt

Please note that this is on a SilverlightChild Window


Thank you for posting at Dotnetfunda


Posted by: Vuyiswamb on: 6/5/2011 [Member] [MVP] [Administrator] NotApplicable | Points: 25


This was just a Security problem. i resolved it like this

1)Right click my computer and select properties

2)Select the "Advanced System Settings"

3)Select "Settings" in the Perfomance category

4) Select "Data Execution Prevention" tab

5) select "Turn on DEP for all programs and services except except those i select"

and click ok , the problem went away

Thank you for posting at Dotnetfunda

Vuyiswamb, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response