Hi I have to store some hidden information in Isolated space. For that I am using System.IO.Isolated class like
IsolatedStorageFile isf = System.IO.Isola
I know this user solved their problem already, but for others looking for an answer. This post is not perfect, but it will point you to what you need to solve this problem.
With asp.net GetMachineStoreForAssembly seems to work in most cases, and it probably the desired mode when using isolated storage from a web app. Because even if you use GetUserStoreForAssembly, it will be isolated by the user account running the asp.net app and it will always be the same for each website user, unless you are somehow mapping each login to an windows user(oh and if you are doing this then it would be working).
The problem is then you try to use GetUserStoreForAssembly because it needs a user with rights to isolated storage, the default IIS user for applications do not get rights for this I guess.
There are 2 solutions:
use GetMachineStoreForAssembly
If you must use GetUserStoreForAssembly set the App to run as user with rights. This is not solved by folder permissions. There are several ways to get security setup.(IIS7) You can set it on the App pool, or under basic settings > Connect As, or under Authenication > Anonymous Authenication. I am not sure exactly what rights the user needs, but this will get you going in the right direction.
Here is some bonus code than may help you figure out your problem:
Dim storageFile As IsolatedStorageFile
If Request("storage") = "user" Then
storageFile = IsolatedStorageFile.GetUserStoreForAssembly()
Else
storageFile = IsolatedStorageFile.GetMachineStoreForAssembly()
End If
Response.Write(storageFile.GetType.GetField("m_RootDir", Reflection.BindingFlags.NonPublic Or Reflection.BindingFlags.Instance).GetValue(storageFile).ToString())
GetUserStoreForAssembly is here: C:\Documents and Settings\Gabe\Local Settings\Application Data\IsolatedStorage\
GetMachineStoreForAssembly is here: C:\Documents and Settings\All Users\Application Data\IsolatedStorage\
I changed IsolatedStorage file to
using (IsolatedStorageFile isoStore = IsolatedStorageFile.GetMachineStoreForAssembly()) { }
And this work.
If it's running on IIS and application pool identity is NetworkService, You can try to go to advanced settings of application pool and set "Load user profile" value to "True". Worked for me.
As John Saunders asks in his comment, please post more of the stack trace, including if possible the lines throwing the expception.
However, using some psychic debugging skills, I'm going to take a couple of wild stabs here that might help:
What sort of account is the site running under in prodution? I assume it's not a user that is able to log on to the server and interact with the file system properly?
How are you running this on the server? If you're running it as a service on the server, you may have a problem with the user assigned to run the service. Make sure you test with the same user you're using on the production server.