views:

58

answers:

6

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 can be written to by anonymous users and any authenticated user.

Does such a place exist?

Thanks Lee

+1  A: 

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).

tvanfosson
A: 

I think the App_Data folder is set up with permissions for something like this.

Luke Lowrey
A: 

Or application variables if you aren't load balancing and it doesn't need to persist between restarts ...

James Westgate
A: 

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

MIchael Grassman
A: 

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.

Chris Marisic
A: 

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

MatthewMartin