Advertisement
Guest User

Untitled

a guest
May 29th, 2012
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. Accessing special folders from Silverlight OutOfBrowser application
  2. var folder = Environment.GetFolderPath(Environment.SpecialFolder.Templates);
  3.  
  4. System.Security.SecurityException was unhandled by user code
  5. Message=File operation not permitted. Access to path '' is denied.
  6. StackTrace:
  7. at System.IO.FileSecurityState.EnsureState()
  8. at System.Environment.InternalGetFolderPath(SpecialFolder folder, SpecialFolderOption option, Boolean checkHost)
  9. at System.Environment.GetFolderPath(SpecialFolder folder)
  10.  
  11. using (dynamic fso = AutomationFactory.CreateObject("Scripting.FileSystemObject"))
  12. {
  13. dynamic file = fso.CreateTextFile(@"C:tmp.txt");
  14. file.WriteLine(@"I just wrote to c: !!");
  15. file.Close();
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement