Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6707867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:41:25+00:00 2026-05-26T07:41:25+00:00

Inside my Silverlight 4.0 application (with elevated trust level), I’m trying to access the

  • 0

Inside my Silverlight 4.0 application (with elevated trust level), I’m trying to access the common templates folder, using the code below:

var folder = Environment.GetFolderPath(Environment.SpecialFolder.Templates);

However, such code throwsSystem.Security.SecurityException:

System.Security.SecurityException was unhandled by user code
  Message=File operation not permitted. Access to path '' is denied.
  StackTrace:
       at System.IO.FileSecurityState.EnsureState()
       at System.Environment.InternalGetFolderPath(SpecialFolder folder, SpecialFolderOption option, Boolean checkHost)
       at System.Environment.GetFolderPath(SpecialFolder folder)

It seems that accessing any folder besides “My Documents” for the current user would throw this kind of exception – Since the SpecialFolder enum has more values, what are they good for? Is there any way to verify which folder this enum/method looks for, or any other way to access it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T07:41:26+00:00Added an answer on May 26, 2026 at 7:41 am

    In Silverlight 4, the “My Documents” area and isolated storage are the only two places that OOB apps my arbitrarily read/write from/to. This will change with Silverlight 5, where elevated trust apps will have greater access to disk.

    As for why it’s there at all, see the remark in the MSDN Documentation:

    This type is present to support the .NET Compact Framework infrastructure in Silverlight for Windows Phone, and it is not intended to be used in your application code.

    It’s worth noting that if you are targeting windows OOB, it is possible to read/write files arbitrarily on disk using COM automation and Scripting.FileSystemObject in Silverlight 4:

    using (dynamic fso = AutomationFactory.CreateObject("Scripting.FileSystemObject"))
    {
        dynamic file = fso.CreateTextFile(@"C:\tmp.txt");
        file.WriteLine(@"I just wrote to c:\ !!");
        file.Close();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Silverlight application that is using a DataGrid. Inside of that DataGrid
I want to include a silverlight application (.xap file) inside a HTML page. Using
I am trying to capture any keystroke that happens inside my Silverlight 2 application.
I have a Silverlight 4 application running inside the browser without elevated permission and
Can I have HTML markup and javascript code existing inside a Silverlight application? For
I saw this Silverlight application that works inside the browser but if you clicked
I have a silverlight application which I load inside a an asp.net website via
I am trying to build an silverlight application which takes user first name, last
I am using the following code to place an image inside an imagebox in
I have silverlight 4 application with PRISM 4, I'm using MEF. My Shell defines

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.