开发者

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:

  1. The path specified by the TMP environment variable.

  2. The path specified by the TEMP environment variable.

  3. The path specified by the USERPROFILE environment variable.

  4. The Windows directory.

Perhaps you can use System.Environment.GetFolderPath instead.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜