views:

177

answers:

1

I am running OOB silverlight application where I have a WebBrowser control but I am getting this error when I call InvokeScript:-

Attempted to perform an unauthorized operation.

Is it because it's OOB ?

+1  A: 

No it can't be because its OOB since WebBrowser only works OOB anyway. I can think of two possible reasons.

  • The Url to which the WebBrowser has navigated is not on the same site from with the Silverlight application has been loaded. This would a security violation.

  • The code that is being executed in the loaded web page by the InvokeScript is the actual source of the error.

AnthonyWJones
About the second reason, the JS function has no errors. but i can't understand the first reason. sorry for getting it long on u but i can't find anything about this error online :S that's wired looks like it only happens to me :D
Miroo
Do u wanna say that i can't access any functions except if i was browsing the site which the application was downloaded from ??!!!!
Miroo
@Miroo: Yes that is exacly what I'm saying. You cannot call JS functions in a page that comes from a different site than you Silverlight application. This would constitute a cross-domain scripting breach which could endanger the users privacy or worse their bank account.
AnthonyWJones
well i found a param that called EnableHTMLAccess must be set to True, but i can't understand where should i have it, in the silverlight object ??!!! how come while i am running my application OOB i am not even debugging through the web page :s
Miroo
@Miroo: EnableHTMLAccess is placed on the object tag when a silverlight application is embedded in a web page, it isn't relevant to your case. An OOB runs "out of browser" so clearly it isn't going to debug through the web page.
AnthonyWJones
Dear antony, Thanks too much, it worked fine when i installed it to my machine, i was testing it from VS debug :)
Miroo