Results 1 to 2 of 2

Thread: Attempted to read or write protected memory. This is often an indication that other m

  1. #1

    Thread Starter
    Fanatic Member vuyiswamb's Avatar
    Join Date
    Jan 2007
    Location
    South Africa
    Posts
    829

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

    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

    Code:
            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

    Code:
      
                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

    Code:
          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. #2
    Frenzied Member MattP's Avatar
    Join Date
    Dec 2008
    Location
    WY
    Posts
    1,227

    Re: Attempted to read or write protected memory. This is often an indication that oth

    I'm not seeing anything you're doing different from telerik's example: http://blogs.telerik.com/blogs/posts...lverlight.aspx

    I cringe that they're suggesting to use HtmlPage.Window.Eval rather than HtmlPage.Window.Invoke.

    http://pietschsoft.com/post/2008/06/...op-Basics.aspx

    http://msdn.microsoft.com/en-us/libr...(v=vs.95).aspx

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width