I'm trying to embed a html form from my Silverlight application directory structure into WebBrowser control. I receive:
"Exception:System.UnauthorizedException: Attempted to perform
unauthorized operation. ....."
I have done the following:
In the project properties
- checked Enable running application out of the browser
- In out-of-browser settings, checked require elevated trust when running outside the browser
- signed xap file with a test certificate
In the registry, I have
- AllowElevatedTrustAppsInBrowser to 1
- AllowLaunchOfElevatedTrustApps to 1
- UpdateConsentMode to 1
Code to assign browser source is like below
browser.Source = new Uri("\a folder in project dir\sample.htm", UriKind.Relative); I tried to construct Uri having absoluate path by having my htm file in C:\ and in my documents; both didn't work.
I created SL project by unchecking "Host the silverlight application on a new web site". I tried same steps on a Silverlight application with "Host the silverlight application on a new web site" option checked when creating the application and with that it worked when I placed the files in ClientBin directory.
If it's going to be a standalone SL application, relative path work different? Can anyone guide me on this?
Thanks. Ananth
Answer: 1
Use NavigateToString:
http://stackoverflow.com/questions/8354719/loading-a-local-html-file-into-a-webbrowser-control
No comments:
Post a Comment
Send us your comment related to the topic mentioned on the blog