This is a migrated thread and some comments may be shown as answers.

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

2 Answers 465 Views
HTMLPlaceHolder
This is a migrated thread and some comments may be shown as answers.
Vuyiswa
Top achievements
Rank 2
Vuyiswa asked on 03 Jun 2011, 11:04 AM
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 asp.net. 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);
    HtmlPage.Window.Eval(code);
}

 

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 asp.net. The Element "RadhtmlplaceHolder1" is a telerik control that is being used as described here  [LINK]http://blogs.telerik.com/kirilstanoev/posts/11-05-10/reading_writing_cookies_with_htmlplaceholder_for_silverlight.aspx[/LINK]
i will not go to the aspx page where the Cookie is being accessed, but the problem comes when setting it in this line

HtmlPage.Window.Eval(code);


 
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


Thanks

2 Answers, 1 is accepted

Sort by
0
Vuyiswa
Top achievements
Rank 2
answered on 05 Jun 2011, 06:52 PM
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
0
Rek
Top achievements
Rank 1
answered on 30 Jul 2013, 10:19 AM
Thank you very much.. I was frustrated in my project. It helped me.
Tags
HTMLPlaceHolder
Asked by
Vuyiswa
Top achievements
Rank 2
Answers by
Vuyiswa
Top achievements
Rank 2
Rek
Top achievements
Rank 1
Share this question
or