Silverlight 4 App with Elevated Trust Mode-OOB


I would like to say thanks to Microsoft for providing access to some of  the resources in the local machine.

I can call it as "Sandbox Barrier". It's just a relax to the barrier. Still, we do not have full control over the local machine resources.

What is elevated trust mode?

We got this relaxation due to elevated trust mode. This mode enables some features like

  1. Clipboard Access

    Elevated trust mode removes the prompt for permissions to access the clip board.
     
  2. HTML Hosting

    Display HTML content in the web browser control.
     
  3. Removal of Cross Domain Restrictions

    Our application can interact with any domain bypassing the normal security check that required the ClientAccessPolicy.xml or CrossDomain.xml files.
     
  4. File Access

    This enables us to access some of local machine resources without user initiated interaction that invokes the OpenFileDialog. As I mention above, still we are limited user folders such as "My Documents","My Videos","My Pictures","My musics"and any sub folders.

    if (App.Current.IsRunningOutOfBrowser && Application.Current.HasElevatedPermissions)
    {
    string picturesPath = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);
    string path = picturesPath + @"\Aru.jpg";
    StreamReader sr = new StreamReader(path);

    string line = sr.ReadLine();
    while (line != null)
    {
    line = sr.ReadLine();
    }
    sr.Close();
    }
     
  5. Notification Window

    The Notification Window is only available in Out-of-Browser (OOB) mode. You can take advantage of this feature to display confirmation of user's actions ("Product saved"), application status ("Application updated, please restart") or warn the user that data were refreshed while he is working on another application.
     
  6. COM Interoperability

    Direct access to COM enabled applications installed on the clients machine

Configure application to run in ELEVATED-TRUST-MODE
 

  1. Create a Silverlight 4 application. Right click on the silverlight application, and select properties.

    SilApp1.jpg
     
  2. Select "Enable running application out of browser" check box as shown in figure.
  3. Once you select the checkbox, you are able to set OOB settings as given bellow.

    SilApp2.jpg

In this OOB settings, select "Require elevated trust when running outside the browser".

Now, whenever you install the application, then there will be warning popup.

SilApp3.jpg

We can customize this popup message using digitally signed XAP.


Similar Articles