LeeW
LeeW

Reputation: 513

ASP.NET Where can I write to without modifying permissions?

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

Upvotes: 3

Views: 129

Answers (6)

MatthewMartin
MatthewMartin

Reputation: 33153

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

Upvotes: 0

Chris Marisic
Chris Marisic

Reputation: 33108

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.

Upvotes: 0

Michael Grassman
Michael Grassman

Reputation: 1935

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

Upvotes: 0

James Westgate
James Westgate

Reputation: 11454

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

Upvotes: 0

Luke Lowrey
Luke Lowrey

Reputation: 3205

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

Upvotes: 0

tvanfosson
tvanfosson

Reputation: 532575

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

Upvotes: 1

Related Questions