views:

262

answers:

2

I am hosting a silverlight 3.0 control on my Sharepoint 2010 page. I am using the built-in SilverlightWebPart web part, where I have provided the path for .xap file.

Its displaying properly, but when I try to access the System.Windows.Browser, its throwing an error. My code is:

public static string GetQueryString(string key)
        {
            try
            {
                var documentQueryString = (Dictionary<string, string>)System.Windows.Browser.HtmlPage.Document.QueryString;
                if (documentQueryString.ContainsKey(key))
                {
                    return documentQueryString[key].ToString();
                }
            }
            catch (Exception ex)
            {
                return ex.Message;
            }
            return string.Empty;
        }

The error I am getting is: The DOM/scripting bridge is disabled. How do I enable this? I know if I host this in a ASP.NET page, I can add the param - <param name="enablehtmlaccess" value="true"/>. I have tried putting this webpart in a "content editor web part", and I have embedded the object tag to call the .xap file and its working totally fine. I need to make it work using the built-in Silverlight web part.

A: 

I need to find a solution to this as well. I am using Silverlight 4, but my problem is basically the same. From within my silverlight control, HtmlPage is inaccessible. I need to access the page that contains the webpart somehow.

Backslider
One way is....you can put a paramter in your HTML <object> code...i.e. <param name="enablehtmlaccess" value="true"/>, but for that you would need to use a ContentEditor web part and put HTML object tag there.
Bhaskar
A: 

Hi - Just bumping this thread.

Did you find a solution to your problem?

I am experiencing the exact same problem.

Best regards Martin

did not....but it stopped giving me the error automatically. I am still looking at what has happened?
Bhaskar