Where can I write to without modifying site permissions? I need to store a value on the server that will remain when all sessions have closed and can be re-read when a new session is started. I need to make sure that no site permissions need to be changed so the location c开发者_开发问答an be written to by anonymous users and any authenticated user.
Does such a place exist?
Thanks Lee
Store the value in the Cache. Make sure to mark it as not removable with a sufficiently long expiration time. The value needs to persist even when the application is restarted, then store it in a database (perhaps in App_Data).
I think the App_Data folder is set up with permissions for something like this.
Or application variables if you aren't load balancing and it doesn't need to persist between restarts ...
Have you thought about saving your session variables in a sql database. This will allow iis to restart and your sessions will still be alive.
http://idunno.org/articles/277.aspx
Sounds like you could also use a public static
field or if the value doesn't change a public static readonly
field internally in the application directly. If you update the value make sure to do locking correctly on updates.
Like everyone else said, depends on if you have a database available or if volatile stores like Profile, session, viewstate or cache will do.
If you are looking for a place to write files to, then consider Isolated Storage, which is like a sandboxed filesystem.
http://msdn.microsoft.com/en-us/library/3ak841sy(VS.80).aspx
精彩评论