【问题标题】:Can all apps access all files in Isolated storage on shared asp.net server?所有应用程序都可以访问共享 asp.net 服务器上隔离存储中的所有文件吗?
【发布时间】:2009-05-27 13:54:16
【问题描述】:
我正在考虑对我的临时文件使用 IsolatedStorage。但是,文档似乎暗示存储空间由 Windows 用户帐户决定,对于 ASP.NET 应用程序来说,该帐户是 NETWORK SERVICES。如果有多个网站/应用程序使用 NETWORK SERVICES 作为他们的帐户,这是否意味着它们都将共享同一个独立存储并能够读取彼此的文件?
【问题讨论】:
标签:
.net
asp.net
security
iis
isolatedstorage
【解决方案1】:
我认为,如果您使用 IsolatedStorageFile 实例构建您的 IsolatedStorageFileStream,您将拥有更大的灵活性,因为它们可以在例如特定于应用程序的基础上创建:
using (IsolatedStorageFile isf = IsolatedStorageFile.GetMachineStoreForApplication())
using (IsolatedStorageFileStream isfs = new IsolatedStorageFileStream("filename", FileMode.Create, isf))
{
// Code using the file stream here...
}