SecurityException when calling System.IO.Path.GetTempPath()
I'm working on a silverlight elevated trust application. I made a call to
System.IO.Path.GetTempPath()
I am getting a Security Exception, message "File operation not permi开发者_运维问答tted. Access to path '' is denied."
Application.Current.HasElevatedPermissions
Returns true
Any help would greatly be appreciated.
Edit: I think you can't do this stuff from the Silverlight sandbox. Try isolated storage instead.
Old answer: From Path.GetTempPath:
This method checks for the existence of environment variables in the following order and uses the first path found:
The path specified by the TMP environment variable.
The path specified by the TEMP environment variable.
The path specified by the USERPROFILE environment variable.
The Windows directory.
Perhaps you can use System.Environment.GetFolderPath instead.
精彩评论