SIGN UP MEMBER LOGIN:    
ARTICLE

Silverlight 4 App with Elevated Trust Mode-OOB

Posted by Aravind BS Articles | Silverlight with C# December 22, 2011
In this article I will demonstrate how to use a Silverlight 4 App With Elevated Trust Mode-OOB.
Reader Level:
Download Files:
 

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.

Login to add your contents and source code to this article
share this article :
post comment
 

Nice presentation

Posted by Jimmy Underwood Dec 26, 2011

It is indeed a good tutorial with a nice simple example to follow......

Posted by Manish Tewatia Dec 26, 2011

Thats a great one dear. Thankx for this article

Posted by Mercy Decosta Dec 26, 2011
Team Foundation Server Hosting
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
Nevron Gauge for SharePoint
Become a Sponsor