简体   繁体   English

IsolatedStorage无法使用IE保护模式? C#

[英]IsolatedStorage Not Working With IE Protected Mode? C#

Using IsolatedStorage with IE Protected Mode . 在IE 保护模式下使用IsolatedStorage

I am building a C# .NET (VS2010) IE8 add-on application but am having some trouble saving data using IsolatedStorage on a Windows 7 64-bit machine, when Internet Explorer's default Protected Mode is enabled. 我正在构建一个C#.NET(VS2010)IE8附加应用程序,但在启用Internet Explorer的默认保护模式使用IsolatedStorage在Windows 7 64位计算机上保存数据时遇到一些问题。

(I am switching to this method from using Settings as Properties.Settings.Default.Save(); which also failed with IE Protected Mode on. I also tried saving files in LocalLow with no luck either.) (我正在使用Settings作为Properties.Settings.Default.Save()切换到这个方法;它也在启用IE保护模式时失败。我也尝试在LocalLow中保存文件,但也没有运气。)

Could anyone point out how I can amend the following code please to enable it to work with IE Protected Mode? 任何人都可以指出我如何修改以下代码,以使其能够与IE保护模式一起使用? I have tried so many ideas and nothing so far has worked. 我已经尝试了很多想法,到目前为止还没有任何工作。 Surely there must be a way to save data?? 当然必须有一种方法来保存数据?

//FileIOPermission perm = new FileIOPermission(PermissionState.Unrestricted); 
    //perm.Assert(); 
    //perm.Demand();  

//---Write---
IsolatedStorageFile app_isoStore = IsolatedStorageFile.GetStore(
    IsolatedStorageScope.User | IsolatedStorageScope.Assembly, null, null);
IsolatedStorageFileStream isoStream = new IsolatedStorageFileStream(
    "app_started.txt", FileMode.OpenOrCreate, FileAccess.Write, app_isoStore);

StreamWriter iswriter = new StreamWriter(isoStream);
iswriter.WriteLine("Run");
iswriter.Close();

//app_isoStore.Dispose();
app_isoStore.Close();

//---Read---
IsolatedStorageFile app_isoStoreCheck = IsolatedStorageFile.GetStore(
    IsolatedStorageScope.User | IsolatedStorageScope.Assembly, null, null);
IsolatedStorageFileStream isoReadStream = new IsolatedStorageFileStream(
    "app_started.txt", FileMode.Open, FileAccess.Read, app_isoStoreCheck);

StreamReader isreader = new StreamReader(isoReadStream);
string rdata = isreader.ReadToEnd();
isreader.Close();

//app_isoStoreCheck.Dispose();
app_isoStoreCheck.Close();

You aren't providing any the evidence arguments. 您没有提供任何证据论据。

Have you tried the following overloads instead of GetStore : 您是否尝试过以下重载而不是GetStore

  • GetUserStoreForApplication GetUserStoreForApplication
  • GetUserStoreForUser GetUserStoreForUser
  • GetUserStoreForDomain GetUserStoreForDomain
  • GetMachineStoreForApplication GetMachineStoreForApplication
  • GetMachineStoreForUser GetMachineStoreForUser
  • GetMachineStoreForDomain GetMachineStoreForDomain

What operating system are you using? 您使用什么操作系统? What version of .NET are you using? 您使用的是什么版本的.NET? What file system type are you executing this on? 您执行此操作的文件系统类型是什么? Are you the administrator of the machine? 你是机器的管理员吗? What is the IsolatedStorage policy on the machine? 机器上的IsolatedStorage策略是什么? Is it enabled? 它启用了吗? How much space does each user have? 每个用户有多少空间?

Can you observe the app_started.txt file being created in the appropriate directory? 你能观察到在适当的目录中创建的app_started.txt文件吗? If not then you might also have a permissions issue... NTFS ACL etc... 如果没有那么您可能还有权限问题... NTFS ACL等...

http://msdn.microsoft.com/en-us/library/3ak841sy(v=vs.80).aspx http://msdn.microsoft.com/en-us/library/3ak841sy(v=vs.80).aspx

Just some suggestions. 只是一些建议。

HTH HTH

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM